# FTransform

Inheritance Hierarchy

FTransform

 TRigidTransform< float, 3 >

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.

Variables

Name Description

Rotation

Rotation of this transformation, as a quaternion.

Scale3D

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

Translation

Translation of this transformation, as a vector.

Constructors

Name Description

FTransform()

Default constructor.

FTransform

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

Constructor that takes basis axes and translation

FTransform

(
const FVector & InTranslation
)

Constructor with an initial translation

FTransform

(
ENoInit
)

Constructor with leaving uninitialized memory

FTransform

(
const FQuat & InRotation
)

Constructor with an initial rotation

FTransform

(
const FRotator & InRotation
)

Constructor with an initial rotation

FTransform

(
const FTransform & InTransform
)

Copy-constructor

FTransform

(
const FMatrix & InMatrix
)

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

FTransform

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

Constructor with all components initialized

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

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

void

Accumulate

(
const FTransform & Atom,
float BlendWeight
)

Accumulates another transform with this one, with a blending weight

void

(
const FTransform & Atom,
float BlendWeight
)

Accumulates another transform with this one, with a blending weight

void

AccumulateWithShortestRotation

(
const FTransform & DeltaAtom,
float BlendWeight
)

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

void

(
const FVector & DeltaTranslation
)

Adjusts the translation component of this transformation

(
const FTransform & A,
const FTransform & B
)

Add the translations from two FTransforms and return the result.

bool

AnyHasNegativeScale

(
const FVector & InScale3D,
const FVector & InOtherScale3D
)

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.

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.

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.

void

Blend

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

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

void

BlendFromIdentityAndAccumulate

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

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

void

BlendWith

(
const FTransform & OtherAtom,
float Alpha
)

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

void

ConcatenateRotation

(
const FQuat & DeltaRotation
)

Concatenates another rotation to this transformation

bool

ContainsNaN()

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

void

CopyRotation

(
const FTransform & Other
)

Copy rotation from another FTransform .

void

CopyRotationPart

(
const FTransform & SrcBA
)

Sets the Rotation and Scale3D of this transformation from another transform

void

CopyScale3D

(
const FTransform & Other
)

Copy scale from another FTransform .

void

CopyTranslation

(
const FTransform & Other
)

Copy translation from another FTransform .

void

CopyTranslationAndScale3D

(
const FTransform & SrcBA
)

Sets the Translation and Scale3D of this transformation from another transform

bool

DebugEqualMatrix

(
const FMatrix & Matrix
)

Debug purpose only

void

DebugPrint()

Does a debugf of the contents of this Transform.

Does a debugf of the contents of this BoneAtom.

void

DiagnosticCheck_IsValid()

void

DiagnosticCheckNaN_All()

void

DiagnosticCheckNaN_Rotate()

void

DiagnosticCheckNaN_Scale3D()

void

DiagnosticCheckNaN_Translate()

bool

Equals

(
const FTransform & Other,
float Tolerance
)

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

bool

EqualsNoScale

(
const FTransform & Other,
float Tolerance
)

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

float

GetDeterminant()

Calculate the determinant of this transformation

GetLocation()

Temp function for easy conversion

float

GetMaximumAxisScale()

Same version of FMatrix::GetMaximumAxisScale function

float

GetMinimumAxisScale()

GetRelativeTransform

(
const FTransform & Other
)

GetRelativeTransformReverse

(
const FTransform & Other
)

GetRotation()

Returns the rotation component

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

GetScale3D()

Returns the Scale3D component

GetScaled

(
FVector Scale
)

Apply Scale to this transform

Apply Scale to this transform

GetScaled

(
float Scale
)

Apply Scale to this transform

GetScaledAxis

(
EAxis::Type InAxis
)

X = 0, y = 1, z = 2

Apply Scale to this transform

GetTranslation()

Returns the translation component

GetUnitAxis

(
EAxis::Type InAxis
)

X = 0, y = 1, z = 2

bool

InitFromString

(
const FString & InSourceString
)

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

Inverse()

Convert this Transform to inverse.

InverseTransformPosition

(
const FVector & V
)

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

InverseTransformPositionNoScale

(
const FVector & V
)

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

InverseTransformRotation

(
const FQuat & Q
)

Inverse transform a rotation.

InverseTransformVector

(
const FVector & V
)

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

InverseTransformVectorNoScale

(
const FVector & V
)

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

bool

IsRotationNormalized()

Checks whether the rotation component is normalized or not

bool

IsValid()

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

void

Mirror

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

void

Multiply

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

Create a new transform: OutTransform = A * B.

void

MultiplyScale3D

(
const FVector & Scale3DMultiplier
)

Scales the Scale3D component by a new factor

void

NormalizeRotation()

Normalize the rotation component of this transformation

void

RemoveScaling

(
float Tolerance
)

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

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.

Rotator()

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.

void

ScaleTranslation

(
const float& Scale
)

void

ScaleTranslation

(
const FVector & InScale3D
)

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

void

SetComponents

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

Sets the components

void

SetFromMatrix

(
const FMatrix & InMatrix
)

void

SetIdentity()

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

void

SetLocation

(
const FVector & Origin
)

Set the translation of this transformation

void

SetRotation

(
const FQuat & NewRotation
)

Sets the rotation component

void

SetScale3D

(
const FVector & NewScale3D
)

Sets the Scale3D component

void

SetToRelativeTransform

(
const FTransform & ParentTransform
)

Set current transform and the relative to ParentTransform.

void

SetTranslation

(
const FVector & NewTranslation
)

Sets the translation component

void

SetTranslationAndScale3D

(
const FVector & NewTranslation,
const FVector & NewScale3D
)

Sets both the translation and Scale3D components at the same time

SubtractTranslations

(
const FTransform & A,
const FTransform & B
)

Subtract translations from two FTransforms and return the difference.

Convert FTransform contents to a string

ToInverseMatrixWithScale()

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

ToMatrixNoScale()

Convert this Transform to a transformation matrix, ignoring its scaling

ToMatrixWithScale()

Convert this Transform to a transformation matrix with scaling.

ToString()

TransformFVector4

(
const FVector4 & V
)

Transform FVector4

TransformFVector4NoScale

(
const FVector4 & V
)

Transform FVector4

TransformPosition

(
const FVector & V
)

TransformPositionNoScale

(
const FVector & V
)

TransformRotation

(
const FQuat & Q
)

Transform a rotation.

TransformVector

(
const FVector & V
)

TransformVectorNoScale

(
const FVector & V
)

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

operator*

(
const FQuat & Other
)

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

operator*

(
const FTransform & Other
)

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

operator*

(
float Mult
)

void

operator*=

(
const FQuat & Other
)

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

void

operator*=

(
const FTransform & Other
)

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

operator*=

(
float Mult
)

operator+

(
const FTransform & Atom
)

operator+=

(
const FTransform & Atom
)

Constants

Name

Description

Identity

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

References