class TTransform

template<typename T>

Contains information about 3D object's position, rotation and scale, and provides methods to manipulate it.

Public

Constructors

TTransform<T>

TTransform<T>() = default

TTransform<T>

TTransform<T>(const TVector3<T> &position, const TQuaternion<T> &rotation, const TVector3<T> &scale)

TTransform

TTransform() = default

TTransform

TTransform(const TVector3<float> &position, const TQuaternion<float> &rotation, const TVector3<float> &scale)

TTransform

TTransform() = default

TTransform

TTransform(const TVector3<double> &position, const TQuaternion<double> &rotation, const TVector3<double> &scale)

Methods

SetPosition

void SetPosition(const TVector3<T> &position)

Sets the local position of the object.

GetPosition

const TVector3<T> &GetPosition() const

Gets the local position of the object.

SetRotation

void SetRotation(const TQuaternion<T> &rotation)

Sets the local rotation of the object.

GetRotation

const TQuaternion<T> &GetRotation() const

Gets the local rotation of the object.

SetScale

void SetScale(const TVector3<T> &scale)

Sets the local scale of the object.

GetScale

const TVector3<T> &GetScale() const

Gets the local scale of the object.

SetWorldPosition

void SetWorldPosition(const TVector3<T> &position, const TTransform<T> &parent)

Converts the provided world position to a space relative to the provided parent, and sets it as the current transform's position.

SetWorldRotation

void SetWorldRotation(const TQuaternion<T> &rotation, const TTransform<T> &parent)

Converts the provided world rotation to a space relative to the provided parent, and sets it as the current transform's rotation.

SetWorldScale

void SetWorldScale(const TVector3<T> &scale, const TTransform<T> &parent)

Converts the provided world scale to a space relative to the provided parent, and sets it as the current transform's scale.

GetMatrix

TMatrix4<T> GetMatrix() const

Builds the transform matrix from current translation, rotation and scale properties.

GetInvMatrix

TMatrix4<T> GetInvMatrix() const

Builds the inverse transform matrix from current translation, rotation and scale properties.

MakeLocal

void MakeLocal(const TTransform<T> &parent)

Makes the current transform relative to the provided transform.

In another words, converts from a world coordinate system to one local to the provided transform.

MakeWorld

void MakeWorld(const TTransform<T> &parent)

Makes the current transform absolute.

In another words, converts from a local coordinate system relative to the provided transform, to a world coordinate system.

LookAt

void LookAt(const TVector3<T> &location, const TVector3<T> &up = TVector3<T>::kUnitY)

Orients the object so it is looking at the provided (world space) where is used for determining the location of the object's Y axis.

Move

void Move(const TVector3<T> &vec)

Moves the object's position by the vector offset provided along world axes.

MoveRelative

void MoveRelative(const TVector3<T> &vec)

Moves the object's position by the vector offset provided along it's own axes (relative to orientation).

GetForward

TVector3<T> GetForward() const

Gets the negative Z (forward) axis of the object.

Returns: Forward axis of the object.

GetUp

TVector3<T> GetUp() const

Gets the Y (up) axis of the object.

Returns: Up axis of the object.

GetRight

TVector3<T> GetRight() const

Gets the X (right) axis of the object.

Returns: Right axis of the object.

SetForward

void SetForward(const TVector3<T> &forwardDir)

Rotates the game object so it's forward axis faces the provided direction.

forwardDir
The forward direction to face.

Rotate

void Rotate(const TVector3<T> &axis, const TRadian<T> &angle)

Rotate the object around an arbitrary axis.

Rotate

void Rotate(const TQuaternion<T> &q)

Rotate the object around an arbitrary axis using a Quaternion.

Roll

void Roll(const TRadian<T> &angle)

Rotates around local Z axis.

angle
Angle to rotate by.

Yaw

void Yaw(const TRadian<T> &angle)

Rotates around Y axis.

angle
Angle to rotate by.

Pitch

void Pitch(const TRadian<T> &angle)

Rotates around X axis

angle
Angle to rotate by.

SetPosition

void SetPosition(const TVector3<float> &position)

Sets the local position of the object.

GetPosition

const TVector3<float> &GetPosition() const

Gets the local position of the object.

SetRotation

void SetRotation(const TQuaternion<float> &rotation)

Sets the local rotation of the object.

GetRotation

const TQuaternion<float> &GetRotation() const

Gets the local rotation of the object.

SetScale

void SetScale(const TVector3<float> &scale)

Sets the local scale of the object.

GetScale

const TVector3<float> &GetScale() const

Gets the local scale of the object.

SetWorldPosition

void SetWorldPosition(const TVector3<float> &position, const TTransform<float> &parent)

Converts the provided world position to a space relative to the provided parent, and sets it as the current transform's position.

SetWorldRotation

void SetWorldRotation(const TQuaternion<float> &rotation, const TTransform<float> &parent)

Converts the provided world rotation to a space relative to the provided parent, and sets it as the current transform's rotation.

SetWorldScale

void SetWorldScale(const TVector3<float> &scale, const TTransform<float> &parent)

Converts the provided world scale to a space relative to the provided parent, and sets it as the current transform's scale.

GetMatrix

TMatrix4<float> GetMatrix() const

Builds the transform matrix from current translation, rotation and scale properties.

GetInvMatrix

TMatrix4<float> GetInvMatrix() const

Builds the inverse transform matrix from current translation, rotation and scale properties.

MakeLocal

void MakeLocal(const TTransform<float> &parent)

Makes the current transform relative to the provided transform.

In another words, converts from a world coordinate system to one local to the provided transform.

MakeWorld

void MakeWorld(const TTransform<float> &parent)

Makes the current transform absolute.

In another words, converts from a local coordinate system relative to the provided transform, to a world coordinate system.

LookAt

void LookAt(const TVector3<float> &location, const TVector3<float> &up)

Orients the object so it is looking at the provided (world space) where is used for determining the location of the object's Y axis.

Move

void Move(const TVector3<float> &vec)

Moves the object's position by the vector offset provided along world axes.

MoveRelative

void MoveRelative(const TVector3<float> &vec)

Moves the object's position by the vector offset provided along it's own axes (relative to orientation).

GetForward

TVector3<float> GetForward() const

Gets the negative Z (forward) axis of the object.

Returns: Forward axis of the object.

GetUp

TVector3<float> GetUp() const

Gets the Y (up) axis of the object.

Returns: Up axis of the object.

GetRight

TVector3<float> GetRight() const

Gets the X (right) axis of the object.

Returns: Right axis of the object.

SetForward

void SetForward(const TVector3<float> &forwardDir)

Rotates the game object so it's forward axis faces the provided direction.

forwardDir
The forward direction to face.

Rotate

void Rotate(const TVector3<float> &axis, const TRadian<float> &angle)

Rotate the object around an arbitrary axis.

Rotate

void Rotate(const TQuaternion<float> &q)

Rotate the object around an arbitrary axis using a Quaternion.

Roll

void Roll(const TRadian<float> &angle)

Rotates around local Z axis.

angle
Angle to rotate by.

Yaw

void Yaw(const TRadian<float> &angle)

Rotates around Y axis.

angle
Angle to rotate by.

Pitch

void Pitch(const TRadian<float> &angle)

Rotates around X axis

angle
Angle to rotate by.

SetPosition

void SetPosition(const TVector3<double> &position)

Sets the local position of the object.

GetPosition

const TVector3<double> &GetPosition() const

Gets the local position of the object.

SetRotation

void SetRotation(const TQuaternion<double> &rotation)

Sets the local rotation of the object.

GetRotation

const TQuaternion<double> &GetRotation() const

Gets the local rotation of the object.

SetScale

void SetScale(const TVector3<double> &scale)

Sets the local scale of the object.

GetScale

const TVector3<double> &GetScale() const

Gets the local scale of the object.

SetWorldPosition

void SetWorldPosition(const TVector3<double> &position, const TTransform<double> &parent)

Converts the provided world position to a space relative to the provided parent, and sets it as the current transform's position.

SetWorldRotation

void SetWorldRotation(const TQuaternion<double> &rotation, const TTransform<double> &parent)

Converts the provided world rotation to a space relative to the provided parent, and sets it as the current transform's rotation.

SetWorldScale

void SetWorldScale(const TVector3<double> &scale, const TTransform<double> &parent)

Converts the provided world scale to a space relative to the provided parent, and sets it as the current transform's scale.

GetMatrix

TMatrix4<double> GetMatrix() const

Builds the transform matrix from current translation, rotation and scale properties.

GetInvMatrix

TMatrix4<double> GetInvMatrix() const

Builds the inverse transform matrix from current translation, rotation and scale properties.

MakeLocal

void MakeLocal(const TTransform<double> &parent)

Makes the current transform relative to the provided transform.

In another words, converts from a world coordinate system to one local to the provided transform.

MakeWorld

void MakeWorld(const TTransform<double> &parent)

Makes the current transform absolute.

In another words, converts from a local coordinate system relative to the provided transform, to a world coordinate system.

LookAt

void LookAt(const TVector3<double> &location, const TVector3<double> &up)

Orients the object so it is looking at the provided (world space) where is used for determining the location of the object's Y axis.

Move

void Move(const TVector3<double> &vec)

Moves the object's position by the vector offset provided along world axes.

MoveRelative

void MoveRelative(const TVector3<double> &vec)

Moves the object's position by the vector offset provided along it's own axes (relative to orientation).

GetForward

TVector3<double> GetForward() const

Gets the negative Z (forward) axis of the object.

Returns: Forward axis of the object.

GetUp

TVector3<double> GetUp() const

Gets the Y (up) axis of the object.

Returns: Up axis of the object.

GetRight

TVector3<double> GetRight() const

Gets the X (right) axis of the object.

Returns: Right axis of the object.

SetForward

void SetForward(const TVector3<double> &forwardDir)

Rotates the game object so it's forward axis faces the provided direction.

forwardDir
The forward direction to face.

Rotate

void Rotate(const TVector3<double> &axis, const TRadian<double> &angle)

Rotate the object around an arbitrary axis.

Rotate

void Rotate(const TQuaternion<double> &q)

Rotate the object around an arbitrary axis using a Quaternion.

Roll

void Roll(const TRadian<double> &angle)

Rotates around local Z axis.

angle
Angle to rotate by.

Yaw

void Yaw(const TRadian<double> &angle)

Rotates around Y axis.

angle
Angle to rotate by.

Pitch

void Pitch(const TRadian<double> &angle)

Rotates around X axis

angle
Angle to rotate by.

Private

Fields

mPosition

TVector3<T> mPosition

mRotation

TQuaternion<T> mRotation

mScale

TVector3<T> mScale

mPosition

TVector3<float> mPosition

mRotation

TQuaternion<float> mRotation

mScale

TVector3<float> mScale

mPosition

TVector3<double> mPosition

mRotation

TQuaternion<double> mRotation

mScale

TVector3<double> mScale