Transform

template<IsFloatingPoint T>
struct Transform

Rigid body transform with position, rotation, scale, and kinematic quantities.

Represents a 3D transformation including translation, rotation, scale, velocity, and angular velocity. Provides methods for conversion to matrix, inversion, composition, and application to points, directions, and velocities.

Template Parameters:

T – Floating point type (float or double)

Public Functions

template<IsFloatingPoint U>
explicit operator Transform<U>() const

Convert this Transform to another floating point type.

Template Parameters:

U – Target floating point type

Returns:

Transform

Mat4<T> to_matrix() const

Convert the transform to a 4x4 matrix (T * R * S).

Returns:

Mat4<T> Transformation matrix

Transform<T> inverse() const

Compute the inverse of the transform.

Returns:

Transform<T> Inverse transform

Transform<T> operator*(const Transform<T> &b) const

Compose this transform with another.

Parameters:

b – Other transform

Returns:

Transform<T> Composed transform

Vec3<T> apply_to_point(const Vec3<T> &point) const

Apply the transform to a point (scale, rotate, translate).

Parameters:

point – Point to transform

Returns:

Vec3<T> Transformed point

Vec3<T> apply_to_direction(const Vec3<T> &dir) const

Apply the transform to a direction (scale, rotate).

Parameters:

dir – Direction to transform

Returns:

Vec3<T> Transformed direction

Vec3<T> apply_to_velocity(const Vec3<T> &vel) const

Apply the transform to a velocity (scale, rotate, add velocity).

Parameters:

vel – Velocity to transform

Returns:

Vec3<T> Transformed velocity

Vec3<T> apply_to_angular_velocity(const Vec3<T> &ang_vel) const

Apply the transform to an angular velocity (rotate, add angular velocity).

Parameters:

ang_vel – Angular velocity to transform

Returns:

Vec3<T> Transformed angular velocity

Vec3<T> velocity_of_point(const Vec3<T> &point) const

Compute the velocity of a point in this reference frame.

Compute the velocity of a point rigidly attached to this frame.

Parameters:

point – Point in world coordinates

Returns:

Vec3<T> Velocity of the point

Vec3<T> velocity_of_local_point(const Vec3<T> &local_point) const

Compute the velocity of a point expressed in local coordinates.

Compute the velocity of a point specified in local coordinates.

Parameters:

local_point – Point in local coordinates

Returns:

Vec3<T> Velocity of the point

Public Members

Vec3<T> position = {0, 0, 0}
Rotation<T> rotation = {}
Vec3<T> scale = {1, 1, 1}
Vec3<T> velocity = {0, 0, 0}
Vec3<T> angular_velocity = {0, 0, 0}