Engine → Core → transform.h
transform¶
| Type | Struct |
| Namespace | conjure::math |
| Include File Path | engine/include/conjure/core/math/transform.h |
| Source File Path | engine/src/core/math/transform.cpp |
| API ↗ | Math |
Syntax¶
Variables¶
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | position | vec3 | vec3(0.0f) | |
| public | rotation | quat | quat(1.0f, | |
| public | scale | vec3 | vec3(1.0f) |
Functions¶
Public¶
from_matrix¶
from_matrix¶Decomposes a TRS matrix (no shear). A negative determinant (mirroring) is expressed as a negative x scale; a zero-length axis yields a zero scale on that axis and the identity direction for its rotation column.
inverse¶
inverse¶[[nodiscard]] transform inverse() const noexcept;The transform that undoes this one: inverse() * (*this) is the identity for every transform, and inverse().to_matrix() equals glm::inverse(to_matrix()) when the scale is uniform. A (nearly) zero scale component inverts to zero instead of infinity.
inverse_transform_direction¶
inverse_transform_direction¶Rotates a direction from the parent space back into local space.
inverse_transform_point¶
inverse_transform_point¶Maps a point from the parent space back into this transform's local space; exact for every scale (the exact inverse of transform_point, including non-uniform scale).
lerp¶
lerp¶Interpolates position and scale linearly and the rotation by shortest-path slerp. t is not clamped (like math::lerp): values outside [0, 1] extrapolate.
look_at¶
look_at¶A transform at eye whose forward() points at target with the given up hint and unit scale. A target equal to eye keeps the identity rotation; an up hint parallel to the view direction (or zero) is replaced by the world axis least aligned with the direction so the result is always a valid rotation.
to_matrix¶
to_matrix¶[[nodiscard]] mat4 to_matrix() const noexcept;The 4x4 matrix translate(position) * rotate(rotation) * scale(scale).
transform_direction¶
transform_direction¶Applies only the rotation to a direction (no scale, no translation).
transform_point¶
transform_point¶Applies scale, rotation and translation to a point in this transform's local space.
Operator Overloads¶
Public¶
operator*¶
operator*¶Composes parent * child: the child expressed in the parent's space is moved into the parent's parent space. Equals from_matrix(to_matrix() * child.to_matrix()) exactly when the parent scale is uniform or the child rotation is the identity.