Enzo
Loading...
Searching...
No Matches
enzo::Transform Class Reference

An affine transform that composes translation, rotation, and scale. More...

#include <Transform.h>

Public Types

using Affine = Eigen::Transform<floatT, 3, Eigen::Affine>
 

Public Member Functions

 Transform ()
 Constructs an identity transform.
 
 Transform (const Matrix4 &matrix)
 Wraps an existing matrix.
 
Transformtranslate (const Vector3 &offset)
 Moves the local origin by an offset.
 
TransformrotateEuler (const Vector3 &degrees)
 Rotates in X, then Y, then Z, with angles given in degrees.
 
Transformscale (const Vector3 &factors)
 Scales each local axis independently.
 
Transformscale (floatT uniform)
 Scales all local axes by the same factor.
 
Transformcompose (const Transform &other)
 Composes another transform into this one in the local frame.
 
Vector3 operator* (const Vector3 &point) const
 Applies the transform to a point.
 
const Matrix4 & getMatrix () const
 

Static Public Member Functions

static Transform fromAttribute (const attr::Attribute &attribute, Offset offset)
 Reads a transform from a single attribute value.
 
static Transform lookAt (const Vector3 &translation, const Vector3 &forward, const Vector3 &up)
 Builds an orientation frame that points down a forward axis.
 

Detailed Description

An affine transform that composes translation, rotation, and scale.

Builder methods mutate in place and return a reference so calls can be chained. Factory methods construct a Transform from other representations such as an attribute value or an orientation frame.

Note
The transform is stored as an Eigen affine transform whose operations skip the homogeneous bottom row, so composing and applying it costs less than a full 4x4 multiply. Builders and accessors are inline so they survive per element hot paths.

Member Function Documentation

◆ fromAttribute()

Transform enzo::Transform::fromAttribute ( const attr::Attribute & attribute,
Offset offset )
static

Reads a transform from a single attribute value.

Returns
The transform encoded at the given offset.
Note
A vector attribute becomes a translation. A matrix attribute is used directly. Any other type yields the identity.

◆ lookAt()

Transform enzo::Transform::lookAt ( const Vector3 & translation,
const Vector3 & forward,
const Vector3 & up )
static

Builds an orientation frame that points down a forward axis.

Returns
A transform whose rotation aligns to the frame, placed at translation.
Note
The rotation maps the local Z axis onto forward and the local Y axis toward up. The up vector resolves the remaining roll. When forward and up are parallel the rotation falls back to identity.

◆ operator*()

Vector3 enzo::Transform::operator* ( const Vector3 & point) const
inline

Applies the transform to a point.

Returns
The point with the transform's scale, rotation, and translation applied.

The documentation for this class was generated from the following files: