URL: https://graphicscomputing.fr/cgp/reference/affine/
Description: Affine transform made of a rotation, uniform and per-axis scalings, and a translation (no shear).

# affine

Affine transform made of a rotation, uniform and per-axis scalings, and a translation (no shear).

Fields:

- `rotation_transform rotation` - Rotation part of the transform, applied after the scalings.
- `vec3 translation` - Translation part of the transform, applied last.
- `float scaling` - Uniform scaling factor (default 1), combined with scaling_xyz before the rotation.
- `vec3 scaling_xyz` - Scaling factors along the local x, y and z axes, applied before the rotation (default (1,1,1)).

Functions taking it:

- `std::string type_str(affine const&)` - Type name "affine".
- `std::string str(affine const& T)` - String listing the rotation, translation, scaling and scaling_xyz of the affine transform.

Operators:

- `vec3 operator*(affine const& T, vec3 const& p)` - Apply the affine transform to a point: rotation * (scaling * scaling_xyz * p) + translation (scaling_xyz stretches the local axes).
- `vec4 operator*(affine const& T, vec4 const& p)` - Apply the affine transform to a homogeneous vector, the translation being weighted by w: a direction (w=0) is not translated.
- `affine operator*(affine_rts const& T1, affine const& T2)` - Composition T1 o T2 of a rotation-translation-scaling (parent) with an affine transform (child), exact for any scaling_xyz.
- `affine operator*(affine_rt const& T1, affine const& T2)` - Composition T1 o T2 of a rigid transform (parent) with an affine transform (child), exact for any scaling_xyz.
- `affine operator*(affine const& T1, affine_rts const& T2)` - Composition T1 o T2 of an affine transform with a rotation-translation-scaling, returned as an affine; asserts that T1.scaling_xyz is uniform (use T1.matrix()*T2.matrix() otherwise).
- `affine operator*(affine const& T1, affine_rt const& T2)` - Composition T1 o T2 of an affine transform with a rigid transform, returned as an affine; asserts that T1.scaling_xyz is uniform (use T1.matrix()*T2.matrix() otherwise).
- `mat4 operator*(affine const& T1, mat4 const& T2)` - Product of the 4x4 matrix of the affine transform with a mat4.
- `mat4 operator*(mat4 const& T1, affine const& T2)` - Product of a mat4 with the 4x4 matrix of the affine transform.
- `mat4 operator*(affine const& T1, mat3 const& T2)` - Product of the 4x4 matrix of the affine transform with a mat3 extended to a mat4.
- `mat4 operator*(mat3 const& T1, affine const& T2)` - Product of a mat3 extended to a mat4 with the 4x4 matrix of the affine transform.
- `std::ostream& operator<<(std::ostream& s, affine const& T)` - Write str(T) of the affine transform to the stream.
