URL: https://graphicscomputing.fr/cgp/reference/rotation_transform/
Description: 3D rotation (stored as a unit quaternion).

# rotation_transform

3D rotation (stored as a unit quaternion).

Fields:

- `quaternion data` - Unit quaternion (x, y, z, w) storing the rotation, w being the scalar part.

Functions taking it:

- `affine_rt rotation_around_center(rotation_transform const& R, vec3 const& center)` - Rigid transform that applies the rotation R around center instead of the origin, mapping p to R(p - center) + center.
- `rotation_transform inverse(rotation_transform const& r)` - Inverse rotation.
- `std::string type_str(rotation_transform const&)` - Type name "rotation_transform".
- `std::string str(rotation_transform const& r)` - String of the underlying unit quaternion (x y z w) of the rotation.
- `vec3 translation_in_plane(vec2 const& translation, rotation_transform const& plane_orientation)` - 3D vector of a 2D translation expressed in the xy plane of the given orientation.

Functions returning it:

- `rotation_transform rotation_axis_angle(vec3 const& axis, float angle)` - Rotation of a given angle in radians around an axis (normalized internally).
- `rotation_transform trackball_rotation(vec2 const& p0, vec2 const& p1)` - Rotation moving the trackball projection of p0 onto that of p1, identity if the two points are closer than 1e-4.

Operators:

- `affine_rt operator*(affine_rt const& T, rotation_transform const& R)` - Rigid transform T o R: the rotation is applied before T.
- `affine_rt operator*(rotation_transform const& R, affine_rt const& T)` - Rigid transform R o T: the rotation is applied after T, rotating its translation as well.
- `affine_rts operator*(affine_rts const& T, rotation_transform const& R)` - Transform T o R: the rotation is applied before T.
- `affine_rts operator*(rotation_transform const& R, affine_rts const& T)` - Transform R o T: the rotation is applied after T, rotating its translation as well.
- `affine_rts operator*(float s, rotation_transform const& r)` - Rotation-translation-scaling transform made of the rotation r scaled by s, with zero translation.
- `affine_rts operator*(rotation_transform const& r, float s)` - Rotation-translation-scaling transform made of the rotation r scaled by s, with zero translation.
- `frame operator*(rotation_transform const& R, frame const& f)` - Frame rotated around the origin: both its orientation and its position are rotated.
- `rotation_transform operator*(rotation_transform const& r1, rotation_transform const& r2)` - Composition r1 o r2 of two rotations (product of their quaternions).
- `rotation_transform& operator*=(rotation_transform& r1, rotation_transform const& r2)` - In-place composition r1 = r1 o r2.
- `vec3 operator*(rotation_transform const& r, vec3 const& p)` - Vector rotated by the rotation.
- `vec4 operator*(rotation_transform const& r, vec4 const& p)` - Homogeneous vector whose xyz part is rotated, w being kept.
- `mat3 operator*(rotation_transform const& r, mat3 const& M)` - Product of the rotation matrix with a mat3.
- `mat4 operator*(rotation_transform const& r, mat4 const& M)` - Product of the rotation, as a 4x4 matrix, with a mat4.
- `std::ostream& operator<<(std::ostream& s, rotation_transform const& r)` - Write the underlying unit quaternion of the rotation to the stream.
