FTransform

Syntax

struct FTransform

Remarks

Transform composed of Scale, Rotation (as a quaternion), and Translation.

Transforms can be used to convert from one space to another, for example by transforming positions and directions from local space to world space.

Transformation of position vectors is applied in the order: Scale -> Rotate -> Translate. Transformation of direction vectors is applied in the order: Scale -> Rotate.

Order matters when composing transforms: C = A * B will yield a transform C that logically first applies A then B to any subsequent transformation. Note that this is the opposite order of quaternion (FQuat ) multiplication.

Example: LocalToWorld = (DeltaRotation * LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = (LocalToWorld * DeltaRotation) will change rotation in world space by DeltaRotation.

Transform composed of Quat/Translation/Scale. The full C++ class is located here: Engine\Source\Runtime\Core\Public\Math\Transform.h

Variables

Name Description

Protected variable

FQuat

 

Rotation

Rotation of this transformation, as a quaternion.

Protected variable

FVector

 

Scale3D

3D scale (always applied in local space) as a vector.

Protected variable

FVector

 

Translation

Translation of this transformation, as a vector.

Constructors

Name Description

Public function

FTransform()

Default constructor.

Public function

FTransform

(
    const FVector & InX,
    const FVector & InY,
    const FVector & InZ,
    const FVector & InTranslation
)

Constructor that takes basis axes and translation

Public function

FTransform

(
    const FVector & InTranslation
)

Constructor with an initial translation

Public function

FTransform

(
    ENoInit
)

Constructor with leaving uninitialized memory

Public function

FTransform

(
    const FQuat & InRotation
)

Constructor with an initial rotation

Public function

FTransform

(
    const FRotator & InRotation
)

Constructor with an initial rotation

Public function

FTransform

(
    const FTransform & InTransform
)

Copy-constructor

Public function

FTransform

(
    const FMatrix & InMatrix
)

Constructor for converting a Matrix (including scale) into a FTransform .

Public function

FTransform

(
    const FQuat & InRotation,
    const FVector & InTranslation,
    const FVector & InScale3D
)

Constructor with all components initialized

Public function

FTransform

(
    const FRotator & InRotation,
    const FVector & InTranslation,
    const FVector & InScale3D
)

Constructor with all components initialized, taking a FRotator as the rotation component

Functions

Name Description

Public function

void

 

Accumulate

(
    const FTransform & SourceAtom
)

: Added template type function for Accumulate The template type isn't much useful yet, but it is with the plan to move forward to unify blending features with just type of additive or full pose Eventually it would be nice to just call blend and it all works depending on full pose or additive, but right now that is a lot more refactoring For now this types only defines the different functionality of accumulate Accumulates another transform with this one

Public function

void

 

Accumulate

(
    const FTransform & Atom,
    float BlendWeight
)

Accumulates another transform with this one, with a blending weight

Public function

void

 

AccumulateWithAdditiveScale

(
    const FTransform & Atom,
    float BlendWeight
)

Accumulates another transform with this one, with a blending weight

Public function

void

 

AccumulateWithShortestRotation

(
    const FTransform & DeltaAtom,
    float BlendWeight
)

Accumulates another transform with this one, with an optional blending weight

Public function

void

 

AddToTranslation

(
    const FVector & DeltaTranslation
)

Adjusts the translation component of this transformation

Public function Static

FVector

 

AddTranslations

(
    const FTransform & A,
    const FTransform & B
)

Add the translations from two FTransforms and return the result.

A.Translation + B.Translation

Public function Static

bool

 

AnyHasNegativeScale

(
    const FVector & InScale3D,
    const FVector & InOtherScale3D
)

Public function Static

bool

 

AreRotationsEqual

(
    const FTransform & A,
    const FTransform & B,
    float Tolerance
)

Test if A's rotation equals B's rotation, within a tolerance. Preferred over "A.GetRotation().Equals(B.GetRotation())" because it is faster on some platforms.

Public function Static

bool

 

AreScale3DsEqual

(
    const FTransform & A,
    const FTransform & B,
    float Tolerance
)

Test if A's scale equals B's scale, within a tolerance. Preferred over "A.GetScale3D().Equals(B.GetScale3D())" because it is faster on some platforms.

Public function Static

bool

 

AreTranslationsEqual

(
    const FTransform & A,
    const FTransform & B,
    float Tolerance
)

Test if A's translation equals B's translation, within a tolerance. Preferred over "A.GetTranslation().Equals(B.GetTranslation())" because it is faster on some platforms.

Public function

void

 

Blend

(
    const FTransform & Atom1,
    const FTransform & Atom2,
    float Alpha
)

Set this transform to the weighted blend of the supplied two transforms.

Public function Static

void

 

BlendFromIdentityAndAccumulate

(
    FTransform & FinalAtom,
    FTransform & SourceAtom,
    float BlendWeight
)

Blends the Identity transform with a weighted source transform and accumulates that into a destination transform

Public function

void

 

BlendWith

(
    const FTransform & OtherAtom,
    float Alpha
)

Set this Transform to the weighted blend of it and the supplied Transform.

Public function

void

 

ConcatenateRotation

(
    const FQuat & DeltaRotation
)

Concatenates another rotation to this transformation

Public function

bool

 

ContainsNaN()

Checks the components for non-finite values (NaN or Inf).

Public function

void

 

CopyRotation

(
    const FTransform & Other
)

Copy rotation from another FTransform .

Public function

void

 

CopyRotationPart

(
    const FTransform & SrcBA
)

Sets the Rotation and Scale3D of this transformation from another transform

Public function

void

 

CopyScale3D

(
    const FTransform & Other
)

Copy scale from another FTransform .

Public function

void

 

CopyTranslation

(
    const FTransform & Other
)

Copy translation from another FTransform .

Public function

void

 

CopyTranslationAndScale3D

(
    const FTransform & SrcBA
)

Sets the Translation and Scale3D of this transformation from another transform

Public function

bool

 

DebugEqualMatrix

(
    const FMatrix & Matrix
)

Debug purpose only

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1) voi...

 

DebugPrint()

Replacement of Inverse of FMatrix .

Public function

void

 

DiagnosticCheck_IsValid()

Public function

void

 

DiagnosticCheckNaN_All()

Public function

void

 

DiagnosticCheckNaN_Rotate()

Public function

void

 

DiagnosticCheckNaN_Scale3D()

Public function

void

 

DiagnosticCheckNaN_Translate()

Public function

bool

 

Equals

(
    const FTransform & Other,
    float Tolerance
)

Test if all components of the transforms are equal, within a tolerance.

Public function

bool

 

EqualsNoScale

(
    const FTransform & Other,
    float Tolerance
)

Test if rotation and translation components of the transforms are equal, within a tolerance.

Public function

float

 

GetDeterminant()

Calculate the

Public function

FVector

 

GetLocation()

Temp function for easy conversion

Public function

float

 

GetMaximumAxisScale()

Same version of FMatrix::GetMaximumAxisScale function

Public function

float

 

GetMinimumAxisScale()

The minimum magnitude of all components of the 3D scale.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FTra ...

 

GetRelativeTransform

(
    const FTransform & Other
)

Inverse does not work well with VQS format(in particular non-uniform), so removing it, but made two below functions to be used instead.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FTra ...

 

GetRelativeTransformReverse

(
    const FTransform & Other
)

Public function

FQuat

 

GetRotation()

Returns the rotation component

The rotation component

Public function

FQuat

 

GetRotationV()

Returns an opaque copy of the rotation component This method should be used when passing rotation from one FTransform to another

Public function Static

FVector

 

GetSafeScaleReciprocal

(
    const FVector & InScale,
    float Tolerance
)

Mathematically if you have 0 scale, it should be infinite, however, in practice if you have 0 scale, and relative transform doesn't make much sense anymore because you should be instead of showing gigantic infinite mesh also returning BIG_NUMBER causes sequential NaN issues by multiplying so we hardcode as 0

Public function

FVector

 

GetScale3D()

Returns the Scale3D component

The Scale3D component

Public function

FVector

 

GetScale3DV()

Returns an opaque copy of the Scale3D component This method should be used when passing Scale3D from one FTransform to another

Public function

FTransform

 

GetScaled

(
    FVector Scale
)

Apply Scale to this transform

Public function

FTransform

 

GetScaled

(
    float Scale
)

Apply Scale to this transform

Public function

FVector

 

GetScaledAxis

(
    EAxis::Type InAxis
)

X = 0, y = 1, z = 2

Public function

FVector

 

GetTranslation()

Returns the translation component

The translation component

Public function

FVector

 

GetTranslationV()

Returns an opaque copy of the translation component This method should be used when passing translation from one FTransform to another

Public function

FVector

 

GetUnitAxis

(
    EAxis::Type InAxis
)

X = 0, y = 1, z = 2

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1) boo...

 

InitFromString

(
    const FString & InSourceString
)

Acceptable form: "%f,%f,%f|%f,%f,%f|%f,%f,%f"

Public function

FTransform

 

Inverse()

Convert this Transform to inverse.

Public function

FVector

 

InverseTransformPosition

(
    const FVector & V
)

Do backward operation when inverse, translation -> rotation -> scale

Public function

FVector

 

InverseTransformPositionNoScale

(
    const FVector & V
)

Do backward operation when inverse, translation -> rotation

Public function

FVector

 

InverseTransformVector

(
    const FVector & V
)

Do backward operation when inverse, translation -> rotation -> scale

Public function

FVector

 

InverseTransformVectorNoScale

(
    const FVector & V
)

Do backward operation when inverse, translation -> rotation

Public function

bool

 

IsRotationNormalized()

Checks whether the rotation component is normalized or not

Public function

bool

 

IsValid()

Public function

void

 

LerpTranslationScale3D

(
    const FTransform & SourceAtom1,
    const FTransform & SourceAtom2,
    float Alpha
)

Set the translation and Scale3D components of this transform to a linearly interpolated combination of two other transforms

Public function

void

 

Mirror

(
    EAxis::Type MirrorAxis,
    EAxis::Type FlipAxis
)

Public function Static

void

 

Multiply

(
    FTransform * OutTransform,
    const FTransform * A,
    const FTransform * B
)

Create a new transform: OutTransform = A * B.

Public function

void

 

MultiplyScale3D

(
    const FVector & Scale3DMultiplier
)

Scales the Scale3D component by a new factor

Public function

void

 

NormalizeRotation()

Normalize the rotation component of this transformation

Public function

void

 

RemoveScaling

(
    float Tolerance
)

This function is from matrix, and all it does is to normalize rotation portion

Public function

bool

 

RotationEquals

(
    const FTransform & Other,
    float Tolerance
)

Test if this Transform's rotation equals another's rotation, within a tolerance. Preferred over "GetRotation().Equals(Other.GetRotation())" because it is faster on some platforms.

Public function

FRotator

 

Rotator()

Public function

bool

 

Scale3DEquals

(
    const FTransform & Other,
    float Tolerance
)

Test if this Transform's scale equals another's scale, within a tolerance. Preferred over "GetScale3D().Equals(Other.GetScale3D())" because it is faster on some platforms.

Public function

void

 

ScaleTranslation

(
    const float& Scale
)

Public function

void

 

ScaleTranslation

(
    const FVector & InScale3D
)

Scale the translation part of the Transform by the supplied vector.

Public function

void

 

SetComponents

(
    const FQuat & InRotation,
    const FVector & InTranslation,
    const FVector & InScale3D
)

Sets the components

Public function

void

 

SetFromMatrix

(
    const FMatrix & InMatrix
)

Public function

void

 

SetIdentity()

Sets the components to the identity transform: Rotation = (0,0,0,1) Translation = (0,0,0) Scale3D = (1,1,1)

Public function

void

 

SetLocation

(
    const FVector & Origin
)

Set the translation of this transformation

Public function

void

 

SetRotation

(
    const FQuat & NewRotation
)

Sets the rotation component

Public function

void

 

SetScale3D

(
    const FVector & NewScale3D
)

Sets the Scale3D component

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1) voi...

 

SetToRelativeTransform

(
    const FTransform & ParentTransform
)

Set current transform and the relative to ParentTransform.

Public function

void

 

SetTranslation

(
    const FVector & NewTranslation
)

Sets the translation component

Public function

void

 

SetTranslationAndScale3D

(
    const FVector & NewTranslation,
    const FVector & NewScale3D
)

Sets both the translation and Scale3D components at the same time

Public function Static

FVector

 

SubtractTranslations

(
    const FTransform & A,
    const FTransform & B
)

Subtract translations from two FTransforms and return the difference.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FStr ...

 

ToHumanReadableString()

Convert FTransform contents to a string

Public function

FMatrix

 

ToInverseMatrixWithScale()

Convert this Transform to matrix with scaling and compute the inverse of that.

Public function

FMatrix

 

ToMatrixNoScale()

Convert this Transform to a transformation matrix, ignoring its scaling

Public function

FMatrix

 

ToMatrixWithScale()

Convert this Transform to a transformation matrix with scaling.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FStr ...

 

ToString()

Public function

FVector4

 

TransformFVector4

(
    const FVector4 & V
)

Transform FVector4

Public function

FVector4

 

TransformFVector4NoScale

(
    const FVector4 & V
)

Transform homogenous FVector4 , ignoring the scaling part of this transform

Public function

FVector

 

TransformPosition

(
    const FVector & V
)

Public function

FVector

 

TransformPositionNoScale

(
    const FVector & V
)

Public function

FVector

 

TransformVector

(
    const FVector & V
)

Public function

FVector

 

TransformVectorNoScale

(
    const FVector & V
)

Public function

bool

 

TranslationEquals

(
    const FTransform & Other,
    float Tolerance
)

Test if this Transform's translation equals another's translation, within a tolerance. Preferred over "GetTranslation().Equals(Other.GetTranslation())" because it is faster on some platforms.

Operators

Name Description

Public function

FTransform

 

operator*

(
    const FQuat & Other
)

Return a transform that is the result of this multiplied by another transform (made only from a rotation).

Public function

FTransform

 

operator*

(
    const FTransform & Other
)

Return a transform that is the result of this multiplied by another transform.

Public function

FTransform

 

operator*

(
    float Mult
)

Public function

void

 

operator*=

(
    const FQuat & Other
)

Sets this transform to the result of this multiplied by another transform (made only from a rotation).

Public function

void

 

operator*=

(
    const FTransform & Other
)

Sets this transform to the result of this multiplied by another transform.

Public function

FTransform &

 

operator*=

(
    float Mult
)

Public function

FTransform

 

operator+

(
    const FTransform & Atom
)

Quaternion addition is wrong here.

Public function

FTransform &

 

operator+=

(
    const FTransform & Atom
)

Constants

Name

Description

Identity

The identity transformation (Rotation = FQuat::Identity, Translation = FVector::ZeroVector, Scale3D = (1,1,1)).

References

Module

Core

Header

Runtime/Core/Public/Math/TransformNonVectorized.h