Skip to content

shz_vec3_rotate_dir

Markdown
SHZ_INLINE shz_vec3_t shz_vec3_rotate_dir(shz_vec3_t vec, float angle, shz_vec3_t axis) SHZ_NOEXCEPT;

Rotates the given 3D vector by angle radians about the given unit-length axis.

NameTypeDescription
vecshz_vec3_tThe vector to rotate.
anglefloatAngle of rotation, in radians.
axisshz_vec3_tUnit-length axis of rotation.

vec rotated by angle about axis.

This is a faster version of shz_vec3_rotate() which skips normalizing the axis of rotation.

  • The axis of rotation must be prenormalized!
  • This routine should only be used for one-off rotations of a single vector. To rotate multiple vectors in a batch, use the XMTRX API.
  • C++ equivalent: none (call the C function from C++)
  • Type-generic form: none
  • Back-ends: SH4: dedicated SH4 implementation · SW: portable C · SPU: shared C implementation
  • Defined in: sh4zam/shz_vector.h:1143
  • Module: Vector, section "Rotations"

shz_vec3_rotate, shz_xmtrx_init_rotation_dir