Method: CGLM::Vec3#rotate_axis_angle
- Defined in:
- ext/cglm/rb_cglm_vec3.c
#rotate_axis_angle(axis, angle[, dest]) ⇒ dest | new Vec3
Rotates self around axis (a Vec3) by the specified angle (in radians)
using Rodrigues' rotation formula. Places the result into dest and
returns dest. Allocates a new Vec3 if dest is omitted.
413 414 415 416 417 418 419 420 |
# File 'ext/cglm/rb_cglm_vec3.c', line 413
VALUE rb_cglm_vec3_rotate_axis_angle(int argc, VALUE *argv, VALUE self) {
VALUE axis, angle, dest;
rb_scan_args(argc, argv, "21", &axis, &angle, &dest);
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
memcpy(&VAL2VEC3(dest), &VAL2VEC3(self), sizeof(vec3));
glm_vec3_rotate(VAL2VEC3(dest), NUM2FLT(angle), VAL2VEC3(axis));
return dest;
}
|