Transform struct

Homogeneous coordinate transformation.

This class stores a general homogeneous coordinate transformation, such as rotation, translation, uniform or non-uniform scaling, and perspective transformations. The inverse of this transformation is also recorded here, since it is required when transforming normal vectors.

Constructors, destructors, conversion operators

Transform()
Create the identity transform.
Transform(const Mat44f& m)
Create a new transform instance for the given matrix.
Transform(const Mat44f& trafo, const Mat44f& inv)
Create a new transform instance for the given matrix and its inverse.

Public functions

auto inverse() const -> Transform
Return the inverse transformation.
auto operator*(const Transform& t) const -> Transform
Concatenate with another transform.
auto vector(const Vec3f& v) const -> Vec3f
Apply the homogeneous transformation to a 3D direction vector.
auto normal(const Vec3f& n) const -> Vec3f
Apply the homogeneous transformation to a 3D normal.
auto point(const Vec3f& p) const -> Vec3f
Transform a point by an arbitrary matrix in homogeneous coordinates.
auto ray(const Ray3f& r) const -> Ray3f
Apply the homogeneous transformation to a ray.
auto box(const Box3f& box) const -> Box3f
Transform the axis-aligned Box and return the bounding box of the result.