ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Transform Class Reference

Represents a 3D transformation including position, rotation, and scale. More...

#include <Transform.h>

Collaboration diagram for Transform:

Public Member Functions

 Transform ()
 Default constructor.
 
 Transform (const Vector3D &eulerXYZS, const Vector3D &position, const Vector3D &scale)
 Constructor initializing with Euler angles, position, and scale.
 
 Transform (const Quaternion &rotation, const Vector3D &position, const Vector3D &scale)
 Constructor initializing with rotation, position, and scale.
 
 Transform (const Vector3D &eulerXYZS, const Vector3D &position, const Vector3D &scale, const Vector3D &rotationOffset, const Vector3D &scaleOffset)
 Constructor initializing with additional rotation and scale offsets.
 
 Transform (const Quaternion &rotation, const Vector3D &position, const Vector3D &scale, const Vector3D &rotationOffset, const Vector3D &scaleOffset)
 Constructor initializing with rotation and offsets.
 
 Transform (const Transform &transform)
 Copy constructor.
 
void SetBaseRotation (const Quaternion &baseRotation)
 Sets the base rotation of the object.
 
Quaternion GetBaseRotation ()
 Gets the base rotation of the object.
 
void SetRotation (const Quaternion &rotation)
 Sets the current rotation of the object.
 
void SetRotation (const Vector3D &eulerXYZS)
 Sets the current rotation of the object using Euler angles.
 
Quaternion GetRotation ()
 Gets the current rotation of the object.
 
void SetPosition (const Vector3D &position)
 Sets the position of the object.
 
Vector3D GetPosition ()
 Gets the position of the object.
 
void SetScale (const Vector3D &scale)
 Sets the scale of the object.
 
Vector3D GetScale ()
 Gets the scale of the object.
 
void SetScaleRotationOffset (const Quaternion &scaleRotationOffset)
 Sets the scale rotation offset of the object.
 
Quaternion GetScaleRotationOffset ()
 Gets the scale rotation offset of the object.
 
void SetRotationOffset (const Vector3D &rotationOffset)
 Sets the rotation offset of the object.
 
Vector3D GetRotationOffset ()
 Gets the rotation offset of the object.
 
void SetScaleOffset (const Vector3D &scaleOffset)
 Sets the scale offset of the object.
 
Vector3D GetScaleOffset ()
 Gets the scale offset of the object.
 
void Rotate (const Vector3D &eulerXYZS)
 Rotates the object by the given Euler angles.
 
void Rotate (const Quaternion &rotation)
 Rotates the object by the given quaternion.
 
void Translate (const Vector3D &offset)
 Translates the object by the given offset.
 
void Scale (const Vector3D &scale)
 Scales the object by the given scale factors.
 
String ToString ()
 Converts the transform to a string representation.
 

Private Attributes

Quaternion baseRotation
 The base rotation of the object as a quaternion.
 
Quaternion rotation
 The current rotation of the object as a quaternion.
 
Vector3D position
 The position of the object in 3D space.
 
Vector3D scale
 The scale of the object in 3D space.
 
Quaternion scaleRotationOffset
 Offset for scaling transformations relative to rotation.
 
Vector3D scaleOffset
 Offset applied to the scale.
 
Vector3D rotationOffset
 Offset applied to the rotation.
 

Detailed Description

Represents a 3D transformation including position, rotation, and scale.

Definition at line 22 of file Transform.h.

Constructor & Destructor Documentation

◆ Transform() [1/6]

Transform ( )

Default constructor.

Definition at line 4 of file Transform.cpp.

◆ Transform() [2/6]

Transform ( const Vector3D eulerXYZS,
const Vector3D position,
const Vector3D scale 
)

Constructor initializing with Euler angles, position, and scale.

Parameters
eulerXYZSThe rotation in XYZ static Euler angles.
positionThe position vector.
scaleThe scale vector.

Definition at line 7 of file Transform.cpp.

References EulerConstants::EulerOrderXYZS, Rotation::GetQuaternion(), position, rotation, and scale.

◆ Transform() [3/6]

Transform ( const Quaternion rotation,
const Vector3D position,
const Vector3D scale 
)

Constructor initializing with rotation, position, and scale.

Parameters
rotationThe rotation as a quaternion.
positionThe position vector.
scaleThe scale vector.

Definition at line 13 of file Transform.cpp.

References position, rotation, and scale.

◆ Transform() [4/6]

Transform ( const Vector3D eulerXYZS,
const Vector3D position,
const Vector3D scale,
const Vector3D rotationOffset,
const Vector3D scaleOffset 
)

Constructor initializing with additional rotation and scale offsets.

Parameters
eulerXYZSThe rotation in XYZ static Euler angles.
positionThe position vector.
scaleThe scale vector.
rotationOffsetOffset for the rotation.
scaleOffsetOffset for the scale.

Definition at line 19 of file Transform.cpp.

References EulerConstants::EulerOrderXYZS, Rotation::GetQuaternion(), position, rotation, rotationOffset, scale, and scaleOffset.

◆ Transform() [5/6]

Transform ( const Quaternion rotation,
const Vector3D position,
const Vector3D scale,
const Vector3D rotationOffset,
const Vector3D scaleOffset 
)

Constructor initializing with rotation and offsets.

Parameters
rotationThe rotation as a quaternion.
positionThe position vector.
scaleThe scale vector.
rotationOffsetOffset for the rotation.
scaleOffsetOffset for the scale.

Definition at line 27 of file Transform.cpp.

References position, rotation, rotationOffset, scale, and scaleOffset.

◆ Transform() [6/6]

Transform ( const Transform transform)

Copy constructor.

Parameters
transformThe transform to copy.

Definition at line 35 of file Transform.cpp.

References baseRotation, position, rotation, rotationOffset, scale, scaleOffset, and scaleRotationOffset.

Member Function Documentation

◆ GetBaseRotation()

Quaternion GetBaseRotation ( )

Gets the base rotation of the object.

Returns
The base rotation as a quaternion.

Definition at line 49 of file Transform.cpp.

References baseRotation.

◆ GetPosition()

Vector3D GetPosition ( )

Gets the position of the object.

Returns
The position vector.

Definition at line 69 of file Transform.cpp.

References position.

Referenced by Rasterizer::Rasterize(), Triangle2D::Triangle2D(), DrGonzoProject::Update(), PhysicsSimulator::Update(), and Object3D::UpdateTransform().

◆ GetRotation()

Quaternion GetRotation ( )

Gets the current rotation of the object.

Returns
The current rotation as a quaternion.

Definition at line 61 of file Transform.cpp.

References baseRotation, and rotation.

Referenced by Rasterizer::Rasterize(), Triangle2D::Triangle2D(), and Object3D::UpdateTransform().

◆ GetRotationOffset()

Vector3D GetRotationOffset ( )

Gets the rotation offset of the object.

Returns
The rotation offset vector.

Definition at line 93 of file Transform.cpp.

References rotationOffset.

Referenced by Object3D::UpdateTransform().

◆ GetScale()

Vector3D GetScale ( )

Gets the scale of the object.

Returns
The scale vector.

Definition at line 77 of file Transform.cpp.

References scale.

Referenced by Triangle2D::Triangle2D(), and Object3D::UpdateTransform().

◆ GetScaleOffset()

Vector3D GetScaleOffset ( )

Gets the scale offset of the object.

Returns
The scale offset vector.

Definition at line 101 of file Transform.cpp.

References scaleOffset.

Referenced by Object3D::UpdateTransform().

◆ GetScaleRotationOffset()

Quaternion GetScaleRotationOffset ( )

Gets the scale rotation offset of the object.

Returns
The scale rotation offset as a quaternion.

Definition at line 85 of file Transform.cpp.

References scaleRotationOffset.

◆ Rotate() [1/2]

void Rotate ( const Quaternion rotation)

Rotates the object by the given quaternion.

Parameters
rotationThe rotation as a quaternion.

Definition at line 109 of file Transform.cpp.

References rotation.

◆ Rotate() [2/2]

void Rotate ( const Vector3D eulerXYZS)

Rotates the object by the given Euler angles.

Parameters
eulerXYZSThe rotation in XYZ static Euler angles.

Definition at line 105 of file Transform.cpp.

References EulerConstants::EulerOrderXYZS, Rotation::GetQuaternion(), and rotation.

◆ Scale()

void Scale ( const Vector3D scale)

Scales the object by the given scale factors.

Parameters
scaleThe scale factors as a vector.

Definition at line 117 of file Transform.cpp.

References scale.

◆ SetBaseRotation()

void SetBaseRotation ( const Quaternion baseRotation)

Sets the base rotation of the object.

Parameters
baseRotationThe base rotation as a quaternion.

Definition at line 45 of file Transform.cpp.

References baseRotation.

Referenced by Rasterizer::Rasterize().

◆ SetPosition()

void SetPosition ( const Vector3D position)

Sets the position of the object.

Parameters
positionThe position vector.

Definition at line 65 of file Transform.cpp.

References position.

Referenced by ObjectAlign::GetTransform(), BoundaryMotionSimulator::Update(), and DrGonzoProject::Update().

◆ SetRotation() [1/2]

void SetRotation ( const Quaternion rotation)

Sets the current rotation of the object.

Parameters
rotationThe rotation as a quaternion.

Definition at line 53 of file Transform.cpp.

References rotation.

Referenced by ObjectAlign::GetTransform().

◆ SetRotation() [2/2]

void SetRotation ( const Vector3D eulerXYZS)

Sets the current rotation of the object using Euler angles.

Parameters
eulerXYZSThe rotation in XYZ static Euler angles.

Definition at line 57 of file Transform.cpp.

References EulerConstants::EulerOrderXYZS, Rotation::GetQuaternion(), and rotation.

◆ SetRotationOffset()

void SetRotationOffset ( const Vector3D rotationOffset)

Sets the rotation offset of the object.

Parameters
rotationOffsetThe rotation offset vector.

Definition at line 89 of file Transform.cpp.

References rotationOffset.

Referenced by ObjectAlign::GetTransform().

◆ SetScale()

void SetScale ( const Vector3D scale)

Sets the scale of the object.

Parameters
scaleThe scale vector.

Definition at line 73 of file Transform.cpp.

References scale.

Referenced by ObjectAlign::GetTransform(), and PhysicsSimulator::Update().

◆ SetScaleOffset()

void SetScaleOffset ( const Vector3D scaleOffset)

Sets the scale offset of the object.

Parameters
scaleOffsetThe scale offset vector.

Definition at line 97 of file Transform.cpp.

References scaleOffset.

◆ SetScaleRotationOffset()

void SetScaleRotationOffset ( const Quaternion scaleRotationOffset)

Sets the scale rotation offset of the object.

Parameters
scaleRotationOffsetThe scale rotation offset as a quaternion.

Definition at line 81 of file Transform.cpp.

References scaleRotationOffset.

◆ ToString()

String ToString ( )

Converts the transform to a string representation.

Returns
A string representing the transform.

Definition at line 121 of file Transform.cpp.

References EulerAngles::Angles, EulerConstants::EulerOrderXYZS, Rotation::GetEulerAngles(), position, rotation, scale, and Vector3D::ToString().

◆ Translate()

void Translate ( const Vector3D offset)

Translates the object by the given offset.

Parameters
offsetThe translation offset vector.

Definition at line 113 of file Transform.cpp.

References position.

Member Data Documentation

◆ baseRotation

Quaternion baseRotation
private

The base rotation of the object as a quaternion.

Definition at line 24 of file Transform.h.

Referenced by GetBaseRotation(), GetRotation(), SetBaseRotation(), and Transform().

◆ position

Vector3D position
private

The position of the object in 3D space.

Definition at line 26 of file Transform.h.

Referenced by GetPosition(), SetPosition(), ToString(), Transform(), Transform(), Transform(), Transform(), Transform(), and Translate().

◆ rotation

Quaternion rotation
private

The current rotation of the object as a quaternion.

Definition at line 25 of file Transform.h.

Referenced by GetRotation(), Rotate(), Rotate(), SetRotation(), SetRotation(), ToString(), Transform(), Transform(), Transform(), Transform(), and Transform().

◆ rotationOffset

Vector3D rotationOffset
private

Offset applied to the rotation.

Definition at line 31 of file Transform.h.

Referenced by GetRotationOffset(), SetRotationOffset(), Transform(), Transform(), and Transform().

◆ scale

Vector3D scale
private

The scale of the object in 3D space.

Definition at line 27 of file Transform.h.

Referenced by GetScale(), Scale(), SetScale(), ToString(), Transform(), Transform(), Transform(), Transform(), and Transform().

◆ scaleOffset

Vector3D scaleOffset
private

Offset applied to the scale.

Definition at line 30 of file Transform.h.

Referenced by GetScaleOffset(), SetScaleOffset(), Transform(), Transform(), and Transform().

◆ scaleRotationOffset

Quaternion scaleRotationOffset
private

Offset for scaling transformations relative to rotation.

Definition at line 28 of file Transform.h.

Referenced by GetScaleRotationOffset(), SetScaleRotationOffset(), and Transform().


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