FTransform

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

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/TransformNonVectorized.h

Include

#include "Math/TransformNonVectorized.h"

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

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& 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 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

Public function

FTransform

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

Constructor that takes basis axes and translation

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.

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 Const

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 Const

bool

 

DebugEqualMatrix

(
    const FMatrix& Matrix
)

Debug purpose only

Public function Const

void

 

DebugPrint()

Does a debugf of the contents of this Transform.

Does a debugf of the contents of this BoneAtom.

Public function Const

void

 

DiagnosticCheck_IsValid()

Public function Const

void

 

DiagnosticCheckNaN_All()

Public function Const

void

 

DiagnosticCheckNaN_Rotate()

Public function Const

void

 

DiagnosticCheckNaN_Scale3D()

Public function Const

void

 

DiagnosticCheckNaN_Translate()

Public function Const

bool

 

Equals

(
    const FTransform& Other,
    float Tolerance
)

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

Public function Const

bool

 

EqualsNoScale

(
    const FTransform& Other,
    float Tolerance
)

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

Public function Const

float

 

GetDeterminant()

Calculate the determinant of this transformation

Public function Const

FVector

 

GetLocation()

Temp function for easy conversion

Public function Const

float

 

GetMaximumAxisScale()

Same version of FMatrix::GetMaximumAxisScale function

Public function Const

float

 

GetMinimumAxisScale()

Public function Const

FTransform

 

GetRelativeTransform

(
    const FTransform& Other
)

Public function Const

FTransform

 

GetRelativeTransformReverse

(
    const FTransform& Other
)

Public function Const

FQuat

 

GetRotation()

Returns the rotation component

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 Const

FVector

 

GetScale3D()

Returns the Scale3D component

Public function Const

FTransform

 

GetScaled

(
    FVector Scale
)

Apply Scale to this transform

Apply Scale to this transform

Public function Const

FTransform

 

GetScaled

(
    float Scale
)

Apply Scale to this transform

Public function Const

FVector

 

GetScaledAxis

(
    EAxis::Type InAxis
)

X = 0, y = 1, z = 2

Apply Scale to this transform

Public function Const

FVector

 

GetTranslation()

Returns the translation component

Public function Const

FVector

 

GetUnitAxis

(
    EAxis::Type InAxis
)

X = 0, y = 1, z = 2

Public function

bool

 

InitFromString

(
    const FString& InSourceString
)

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

Public function Const

FTransform

 

Inverse()

Convert this Transform to inverse.

Public function Const

FVector

 

InverseTransformPosition

(
    const FVector& V
)

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

Public function Const

FVector

 

InverseTransformPositionNoScale

(
    const FVector& V
)

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

Public function Const

FQuat

 

InverseTransformRotation

(
    const FQuat& Q
)

Inverse transform a rotation.

Public function Const

FVector

 

InverseTransformVector

(
    const FVector& V
)

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

Public function Const

FVector

 

InverseTransformVectorNoScale

(
    const FVector& V
)

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

Public function Const

bool

 

IsRotationNormalized()

Checks whether the rotation component is normalized or not

Public function Const

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 Const

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 Const

FRotator

 

Rotator()

Public function Const

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

void

 

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 Const

FString

 

ToHumanReadableString()

Convert FTransform contents to a string

Public function Const

FMatrix

 

ToInverseMatrixWithScale()

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

Public function Const

FMatrix

 

ToMatrixNoScale()

Convert this Transform to a transformation matrix, ignoring its scaling

Public function Const

FMatrix

 

ToMatrixWithScale()

Convert this Transform to a transformation matrix with scaling.

Public function Const

FString

 

ToString()

Public function Const

FVector4

 

TransformFVector4

(
    const FVector4& V
)

Transform FVector4

Public function Const

FVector4

 

TransformFVector4NoScale

(
    const FVector4& V
)

Transform FVector4

Public function Const

FVector

 

TransformPosition

(
    const FVector& V
)

Public function Const

FVector

 

TransformPositionNoScale

(
    const FVector& V
)

Public function Const

FQuat

 

TransformRotation

(
    const FQuat& Q
)

Transform a rotation.

Public function Const

FVector

 

TransformVector

(
    const FVector& V
)

Public function Const

FVector

 

TransformVectorNoScale

(
    const FVector& V
)

Public function Const

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 Const

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 Const

FTransform

 

operator*

(
    const FTransform& Other
)

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

Public function Const

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 Const

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)).

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss