FMatrix

4x4 matrix of floating point values.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

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

Include

#include "Math/Matrix.h"

Syntax

struct FMatrix

Remarks

4x4 matrix of floating point values. Matrix-matrix multiplication happens with a pre-multiple of the transpose in other words, Res = Mat1.operator*(Mat2) means Res = Mat2^T * Mat1, as opposed to Res = Mat1 * Mat2. Matrix elements are accessed with M[RowIndex][ColumnIndex].

Variables

Name Description

Public variable

union FMatrix::...

 

@218

Public variable

float[4][4]

 

M

Constructors

Name Description

Public function

FMatrix()

Constructors.

Public function

FMatrix

(
    EForceInit
)

Constructor.

Public function

FMatrix

(
    const FPlane& InX,
    const FPlane& InY,
    const FPlane& InZ,
    const FPlane& InW
)

Constructor.

Public function

FMatrix

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

Constructor.

Functions

Name Description

Public function

FMatrix

 

ApplyScale

(
    float Scale
)

Apply Scale to this matrix

Public function Const

uint32

 

ComputeHash()

For debugging purpose, could be changed

Public function Const

FMatrix

 

ConcatTranslation

(
    const FVector& Translation
)

Returns a matrix with an additional translation concatenated.

Public function Const

bool

 

ContainsNaN()

Returns true if any element of this matrix is NaN

Public function Const

void

 

DebugPrint()

Output ToString

Public function Const

float

 

Determinant()

Public function Const

bool

 

Equals

(
    const FMatrix& Other,
    float Tolerance
)

Error-tolerant comparison.

Public function

FVector

 

ExtractScaling

(
    float Tolerance
)

Remove any scaling from this matrix (ie magnitude of each row is 1) and return the 3D scale vector that was initially present with error Tolerance

Public function Const

FVector

 

GetColumn

(
    int32 i
)

Get a column of this matrix

Public function Const

bool

 

GetFrustumBottomPlane

(
    FPlane& OutPlane
)

Public function Const

bool

 

GetFrustumFarPlane

(
    FPlane& OutPlane
)

Public function Const

bool

 

GetFrustumLeftPlane

(
    FPlane& OutPlane
)

Public function Const

bool

 

GetFrustumNearPlane

(
    FPlane& OutPlane
)

Frustum plane extraction.

Public function Const

bool

 

GetFrustumRightPlane

(
    FPlane& OutPlane
)

Public function Const

bool

 

GetFrustumTopPlane

(
    FPlane& OutPlane
)

Public function Const

FMatrix

 

GetMatrixWithoutScale

(
    float Tolerance
)

Returns matrix after RemoveScaling with error Tolerance.

Public function Const

float

 

GetMaximumAxisScale()

Public function Const

FVector

 

GetOrigin()

Public function Const

void

 

GetScaledAxes

(
    FVector& X,
    FVector& Y,
    FVector& Z
)

Get axes of this matrix scaled by the scale of the matrix

Public function Const

FVector

 

GetScaledAxis

(
    EAxis::Type Axis
)

Get axis of this matrix scaled by the scale of the matrix

Public function Const

FVector

 

GetScaleVector

(
    float Tolerance
)

Return a 3D scale vector calculated from this matrix (where each component is the magnitude of a row vector) with error Tolerance.

Public function Const

FMatrix

 

GetTransposed()

Public function Const

void

 

GetUnitAxes

(
    FVector& X,
    FVector& Y,
    FVector& Z
)

Get unit length axes of this matrix

Public function Const

FVector

 

GetUnitAxis

(
    EAxis::Type Axis
)

Get unit length axis of this matrix

Public function Const

FMatrix

 

Inverse()

Inverse.

Public function Const

FMatrix

 

InverseFast()

Inverse.

Public function Const

FVector

 

InverseTransformPosition

(
    const FVector& V
)

Inverts the matrix and then transforms V - correctly handles scaling in this matrix.

Public function Const

FVector

 

InverseTransformVector

(
    const FVector& V
)

Transform a direction vector by the inverse of this matrix - will not take into account translation part.

Public function

void

 

Mirror

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

Utility for mirroring this transform across a certain plane, and flipping one of the axis as well.

Public function

void

 

RemoveScaling

(
    float Tolerance
)

NOTE: There is some compiler optimization issues with WIN64 that cause FORCEINLINE to cause a crash Remove any scaling from this matrix (ie magnitude of each row is 1) with error Tolerance

Public function Const

FMatrix

 

RemoveTranslation()

Remove any translation from this matrix.

Public function Const

FRotator

 

Rotator()

Public function Const

float

 

RotDeterminant()

Calculate determinant of rotation 3x3 matrix

Public function

void

 

ScaleTranslation

(
    const FVector& Scale3D
)

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

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Public function

void

 

SetAxes

(
    FVector* Axis0,
    FVector* Axis1,
    FVector* Axis2,
    FVector* Origin
)

Update the axes of the matrix if any value is NULL do not update that axis

Public function

void

 

SetAxis

(
    int32 i,
    const FVector& Axis
)

Set an axis of this matrix

Public function

void

 

SetIdentity()

Set this to the identity matrix.

Public function

void

 

SetOrigin

(
    const FVector& NewOrigin
)

Set the origin of the coordinate system to the given vector.

Public function Const

void

 

To3x4MatrixTranspose

(
    float* Out
)

Convert this Atom to the 3x4 transpose of the transformation matrix.

Public function Const

FQuat

 

ToQuat()

Transform a rotation matrix into a quaternion.

Public function Const

FString

 

ToString()

Get a textual representation of the vector.

Public function Const

FVector4

 

TransformFVector4

(
    const FVector4& V
)

Homogeneous transform.

Public function Const

FVector4

 

TransformPosition

(
    const FVector& V
)

Transform a location - will take into account translation part of the FMatrix.

Public function Const

FVector4

 

TransformVector

(
    const FVector& V
)

Transform a direction vector - will not take into account translation part of the FMatrix.

Public function Const

FMatrix

 

TransposeAdjoint()

Operators

Name Description

Public function Const

bool

 

operator!=

(
    const FMatrix& Other
)

Checks whether another Matrix is not equal to this, within specified tolerance.

Public function Const

FMatrix

 

operator*

(
    float Other
)

This isn't applying SCALE, just multiplying the value to all members - i.e. weighting

Public function Const

FMatrix

 

operator*

(
    const FMatrix& Other
)

Gets the result of multiplying a Matrix to this.

Public function

void

 

operator*=

(
    float Other
)

Multiply this matrix by a weighting factor.

Public function

void

 

operator*=

(
    const FMatrix& Other
)

Multiply this by a matrix.

Public function Const

FMatrix

 

operator+

(
    const FMatrix& Other
)

Gets the result of adding a matrix to this.

Public function

void

 

operator+=

(
    const FMatrix& Other
)

Adds to this matrix.

Public function Const

bool

 

operator==

(
    const FMatrix& Other
)

Checks whether two matrix are identical.

Constants

Name

Description

Identity

Identity matrix.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback