29 M[0][0] =
InX.X; M[0][1] =
InX.Y; M[0][2] =
InX.Z; M[0][3] =
InX.W;
30 M[1][0] =
InY.X; M[1][1] =
InY.Y; M[1][2] =
InY.Z; M[1][3] =
InY.W;
31 M[2][0] =
InZ.X; M[2][1] =
InZ.Y; M[2][2] =
InZ.Z; M[2][3] =
InZ.W;
32 M[3][0] =
InW.X; M[3][1] =
InW.Y; M[3][2] =
InW.Z; M[3][3] =
InW.W;
39 M[0][0] =
InX.X; M[0][1] =
InX.Y; M[0][2] =
InX.Z; M[0][3] = 0.0f;
40 M[1][0] =
InY.X; M[1][1] =
InY.Y; M[1][2] =
InY.Z; M[1][3] = 0.0f;
41 M[2][0] =
InZ.X; M[2][1] =
InZ.Y; M[2][2] =
InZ.Z; M[2][3] = 0.0f;
42 M[3][0] =
InW.X; M[3][1] =
InW.Y; M[3][2] =
InW.Z; M[3][3] = 1.0f;
50 M[0][0] = 1; M[0][1] = 0; M[0][2] = 0; M[0][3] = 0;
51 M[1][0] = 0; M[1][1] = 1; M[1][2] = 0; M[1][3] = 0;
52 M[2][0] = 0; M[2][1] = 0; M[2][2] = 1; M[2][3] = 0;
53 M[3][0] = 0; M[3][1] = 0; M[3][2] = 0; M[3][3] = 1;
70 Result.DiagnosticCheckNaN();
95 *
this = *
this +
Other;
120 DiagnosticCheckNaN();
150 if (FMath::Abs(M[
X][
Y] -
Other.M[
X][
Y]) > Tolerance)
163 return !(*
this ==
Other);
214 return InvSelf.TransformVector(V);
225 Result.M[0][0] = M[0][0];
226 Result.M[0][1] = M[1][0];
227 Result.M[0][2] = M[2][0];
228 Result.M[0][3] = M[3][0];
230 Result.M[1][0] = M[0][1];
231 Result.M[1][1] = M[1][1];
232 Result.M[1][2] = M[2][1];
233 Result.M[1][3] = M[3][1];
235 Result.M[2][0] = M[0][2];
236 Result.M[2][1] = M[1][2];
237 Result.M[2][2] = M[2][2];
238 Result.M[2][3] = M[3][2];
240 Result.M[3][0] = M[0][3];
241 Result.M[3][1] = M[1][3];
242 Result.M[3][2] = M[2][3];
243 Result.M[3][3] = M[3][3];
276 const float*
RESTRICT Src = &(M[0][0]);
279#if PLATFORM_ENABLE_VECTORINTRINSICS
321 M[1][1] * (M[2][2] * M[3][3] - M[2][3] * M[3][2]) -
322 M[2][1] * (M[1][2] * M[3][3] - M[1][3] * M[3][2]) +
323 M[3][1] * (M[1][2] * M[2][3] - M[1][3] * M[2][2])
326 M[0][1] * (M[2][2] * M[3][3] - M[2][3] * M[3][2]) -
327 M[2][1] * (M[0][2] * M[3][3] - M[0][3] * M[3][2]) +
328 M[3][1] * (M[0][2] * M[2][3] - M[0][3] * M[2][2])
331 M[0][1] * (M[1][2] * M[3][3] - M[1][3] * M[3][2]) -
332 M[1][1] * (M[0][2] * M[3][3] - M[0][3] * M[3][2]) +
333 M[3][1] * (M[0][2] * M[1][3] - M[0][3] * M[1][2])
336 M[0][1] * (M[1][2] * M[2][3] - M[1][3] * M[2][2]) -
337 M[1][1] * (M[0][2] * M[2][3] - M[0][3] * M[2][2]) +
338 M[2][1] * (M[0][2] * M[1][3] - M[0][3] * M[1][2])
347 M[0][0] * (M[1][1] * M[2][2] - M[1][2] * M[2][1]) -
348 M[1][0] * (M[0][1] * M[2][2] - M[0][2] * M[2][1]) +
349 M[2][0] * (M[0][1] * M[1][2] - M[0][2] * M[1][1]);
360#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
367 ErrorEnsure(
TEXT(
"TMatrix<T>::InverseFast(), trying to invert a NIL matrix, this results in NaNs! Use Inverse() instead."));
374#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
375 ErrorEnsure(
TEXT(
"TMatrix<T>::InverseFast(), trying to invert a non-invertible matrix, this results in NaNs! Use Inverse() instead."));
378 Result.DiagnosticCheckNaN();
399 Result.DiagnosticCheckNaN();
408 TA.
M[0][0] = this->M[1][1] * this->M[2][2] - this->M[1][2] * this->M[2][1];
409 TA.M[0][1] = this->M[1][2] * this->M[2][0] - this->M[1][0] * this->M[2][2];
410 TA.M[0][2] = this->M[1][0] * this->M[2][1] - this->M[1][1] * this->M[2][0];
413 TA.M[1][0] = this->M[2][1] * this->M[0][2] - this->M[2][2] * this->M[0][1];
414 TA.M[1][1] = this->M[2][2] * this->M[0][0] - this->M[2][0] * this->M[0][2];
415 TA.M[1][2] = this->M[2][0] * this->M[0][1] - this->M[2][1] * this->M[0][0];
418 TA.M[2][0] = this->M[0][1] * this->M[1][2] - this->M[0][2] * this->M[1][1];
419 TA.M[2][1] = this->M[0][2] * this->M[1][0] - this->M[0][0] * this->M[1][2];
420 TA.M[2][2] = this->M[0][0] * this->M[1][1] - this->M[0][1] * this->M[1][0];
428 TA.DiagnosticCheckNaN();
438 const T
SquareSum0 = (M[0][0] * M[0][0]) + (M[0][1] * M[0][1]) + (M[0][2] * M[0][2]);
439 const T
SquareSum1 = (M[1][0] * M[1][0]) + (M[1][1] * M[1][1]) + (M[1][2] * M[1][2]);
440 const T
SquareSum2 = (M[2][0] * M[2][0]) + (M[2][1] * M[2][1]) + (M[2][2] * M[2][2]);
453 DiagnosticCheckNaN();
461 Result.RemoveScaling(Tolerance);
472 const T
SquareSum0 = (M[0][0] * M[0][0]) + (M[0][1] * M[0][1]) + (M[0][2] * M[0][2]);
473 const T
SquareSum1 = (M[1][0] * M[1][0]) + (M[1][1] * M[1][1]) + (M[1][2] * M[1][2]);
474 const T
SquareSum2 = (M[2][0] * M[2][0]) + (M[2][1] * M[2][1]) + (M[2][2] * M[2][2]);
528 for (
int32 i = 0; i < 3; i++)
530 const T
SquareSum = (M[i][0] * M[i][0]) + (M[i][1] * M[i][1]) + (M[i][2] * M[i][2]);
548 Result.M[3][0] = 0.0f;
549 Result.M[3][1] = 0.0f;
550 Result.M[3][2] = 0.0f;
575 Dest[12] = Src[12] + Trans[0];
576 Dest[13] = Src[13] + Trans[1];
577 Dest[14] = Src[14] + Trans[2];
580 DiagnosticCheckNaN();
588 for (
int32 i = 0; i < 4; i++)
590 for (
int32 j = 0; j < 4; j++)
592 if (!FMath::IsFinite(M[i][j]))
607 GetScaledAxis(
EAxis::X).SizeSquared(),
609 GetScaledAxis(
EAxis::Y).SizeSquared(),
610 GetScaledAxis(
EAxis::Z).SizeSquared()
621 GetScaledAxis(
EAxis::X).SizeSquared(),
623 GetScaledAxis(
EAxis::Y).SizeSquared(),
624 GetScaledAxis(
EAxis::Z).SizeSquared()
670 X.
X = M[0][0];
X.Y = M[0][1];
X.Z = M[0][2];
671 Y.X = M[1][0];
Y.Y = M[1][1];
Y.Z = M[1][2];
672 Z.X = M[2][0];
Z.Y = M[2][1];
Z.Z = M[2][2];
678 return GetScaledAxis(
InAxis).GetSafeNormal();
684 GetScaledAxes(
X,
Y,
Z);
697 DiagnosticCheckNaN();
703 M[3][0] = NewOrigin.
X;
704 M[3][1] = NewOrigin.
Y;
705 M[3][2] = NewOrigin.
Z;
706 DiagnosticCheckNaN();
736 DiagnosticCheckNaN();
919 return this->TransformByUsingAdjointT(M,
DetM,
tmpTA);
942 for(
uint32 RowIndex = 0;RowIndex < 3;RowIndex++)
944 M[RowIndex][0] = (&XAxis.
X)[RowIndex];
945 M[RowIndex][1] = (&YAxis.
X)[RowIndex];
946 M[RowIndex][2] = (&ZAxis.
X)[RowIndex];
947 M[RowIndex][3] = 0.0f;
949 M[3][0] = Origin | XAxis;
950 M[3][1] = Origin | YAxis;
951 M[3][2] = Origin | ZAxis;
953 this->DiagnosticCheckNaN();
961 const TVector<T> XAxis = (UpVector ^ ZAxis).GetSafeNormal();
964 for (
uint32 RowIndex = 0; RowIndex < 3; RowIndex++)
966 M[RowIndex][0] = (&XAxis.
X)[RowIndex];
967 M[RowIndex][1] = (&YAxis.
X)[RowIndex];
968 M[RowIndex][2] = (&ZAxis.
X)[RowIndex];
969 M[RowIndex][3] = 0.0f;
975 this->DiagnosticCheckNaN();
#define NULL
Definition oodle2base.h:134
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define ensure( InExpression)
Definition AssertionMacros.h:464
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_DECLARE_LWC_TYPE(...)
Definition LargeWorldCoordinates.h:27
FORCEINLINE void VectorDeinterleave(VectorRegister4Float &RESTRICT OutEvens, VectorRegister4Float &RESTRICT OutOdds, const VectorRegister4Float &RESTRICT Lo, const VectorRegister4Float &RESTRICT Hi)
Definition UnrealMathFPU.h:1777
FORCEINLINE bool VectorMatrixInverse(FMatrix44d *DstMatrix, const FMatrix44d *SrcMatrix)
Definition UnrealMathFPU.h:1603
FORCEINLINE VectorRegister4Float VectorCombineLow(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1757
FORCEINLINE void VectorMatrixMultiply(FMatrix44d *Result, const FMatrix44d *Matrix1, const FMatrix44d *Matrix2)
Definition UnrealMathFPU.h:1538
VectorRegister4Float VectorLoadAligned(const float *Ptr)
Definition UnrealMathFPU.h:451
FORCEINLINE void VectorStore(const VectorRegister4Float &Vec, float *Dst)
Definition UnrealMathFPU.h:566
FORCEINLINE VectorRegister4Float VectorTransformVector(const VectorRegister4Float &VecP, const FMatrix44f *MatrixM)
Definition UnrealMathFPU.h:1619
FORCEINLINE VectorRegister4Float VectorCombineHigh(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1740
void VectorStoreAligned(const VectorRegister4Float &Vec, float *Ptr)
Definition UnrealMathFPU.h:534
FORCEINLINE VectorRegister4Float VectorLoad(const float *Ptr)
Definition UnrealMathFPU.h:394
#define UE_SMALL_NUMBER
Definition UnrealMathUtility.h:130
#define UE_DELTA
Definition UnrealMathUtility.h:186
typename UE::Math::VectorRegisterPrivate::TVectorRegisterTypeHelper< T >::Type TVectorRegisterType
Definition VectorRegister.h:49
@ None
Definition Axis.h:12
bool MakeFrustumPlane(T A, T B, T C, T D, TPlane< T > &OutPlane)
Definition Matrix.inl:756
Definition AdvancedWidgetsModule.cpp:13
Definition UnrealMathUtility.h:270
TBasisVectorMatrix(const TVector< T > &XAxis, const TVector< T > &YAxis, const TVector< T > &ZAxis, const TVector< T > &Origin)
Definition Matrix.inl:940
TLookAtMatrix(const TVector< T > &EyePosition, const TVector< T > &LookAtPosition, const TVector< T > &UpVector)
Definition Matrix.inl:980
TLookFromMatrix(const TVector< T > &EyePosition, const TVector< T > &LookDirection, const TVector< T > &UpVector)
Definition Matrix.inl:958
void SetColumn(int32 i, TVector< T > Value)
Definition Matrix.inl:747
TMatrix< T > Inverse() const
Definition Matrix.inl:384
TVector4< T > TransformPosition(const TVector< T > &V) const
Definition Matrix.inl:184
TVector4< T > TransformVector(const TVector< T > &V) const
Definition Matrix.inl:204
T GetMinimumAxisScale() const
Definition Matrix.inl:604
TMatrix< T > TransposeAdjoint() const
Definition Matrix.inl:404
TMatrix< T > operator+(const TMatrix< T > &Other) const
Definition Matrix.inl:76
T M[4][4]
Definition Matrix.h:49
bool GetFrustumBottomPlane(TPlane< T > &OuTPln) const
Definition Matrix.inl:831
void To3x4MatrixTranspose(T *Out) const
Definition Matrix.inl:252
TVector< T > GetUnitAxis(EAxis::Type Axis) const
Definition Matrix.inl:676
bool GetFrustumLeftPlane(TPlane< T > &OuTPln) const
Definition Matrix.inl:795
TVector< T > GetColumn(int32 i) const
Definition Matrix.inl:740
bool operator!=(const TMatrix< T > &Other) const
Definition Matrix.inl:161
TVector< T > InverseTransformVector(const TVector< T > &V) const
Definition Matrix.inl:211
bool GetFrustumNearPlane(TPlane< T > &OuTPln) const
Definition Matrix.inl:771
TMatrix< T > ApplyScale(T Scale) const
Definition Matrix.inl:898
TMatrix< T > GetMatrixWithoutScale(T Tolerance=UE_SMALL_NUMBER) const
Definition Matrix.inl:458
T GetMaximumAxisScale() const
Definition Matrix.inl:618
bool GetFrustumFarPlane(TPlane< T > &OuTPln) const
Definition Matrix.inl:783
void Mirror(EAxis::Type MirrorAxis, EAxis::Type FlipAxis)
Definition Matrix.inl:847
TVector< T > ExtractScaling(T Tolerance=UE_SMALL_NUMBER)
Definition Matrix.inl:467
bool ContainsNaN() const
Definition Matrix.inl:586
bool GetFrustumRightPlane(TPlane< T > &OuTPln) const
Definition Matrix.inl:807
TMatrix< T > ConcatTranslation(const TVector< T > &Translation) const
Definition Matrix.inl:555
TVector< T > GetScaleVector(T Tolerance=UE_SMALL_NUMBER) const
Definition Matrix.inl:523
TMatrix< T > RemoveTranslation() const
Definition Matrix.inl:545
bool Equals(const TMatrix< T > &Other, T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Matrix.inl:144
TMatrix< T > GetTransposed() const
Definition Matrix.inl:221
void SetIdentity()
Definition Matrix.inl:48
TVector< T > GetScaledAxis(EAxis::Type Axis) const
Definition Matrix.inl:647
bool GetFrustumTopPlane(TPlane< T > &OuTPln) const
Definition Matrix.inl:819
void GetUnitAxes(TVector< T > &X, TVector< T > &Y, TVector< T > &Z) const
Definition Matrix.inl:682
TMatrix< T > InverseFast() const
Definition Matrix.inl:357
TVector4< T > TransformFVector4(const TVector4< T > &V) const
Definition Matrix.inl:170
void GetScaledAxes(TVector< T > &X, TVector< T > &Y, TVector< T > &Z) const
Definition Matrix.inl:668
void operator+=(const TMatrix< T > &Other)
Definition Matrix.inl:93
void SetAxis(int32 i, const TVector< T > &Axis)
Definition Matrix.inl:691
bool operator==(const TMatrix< T > &Other) const
Definition Matrix.inl:126
TVector< T > GetOrigin() const
Definition Matrix.inl:641
T Determinant() const
Definition Matrix.inl:318
void ScaleTranslation(const TVector< T > &Scale3D)
Definition Matrix.inl:631
void RemoveScaling(T Tolerance=UE_SMALL_NUMBER)
Definition Matrix.inl:435
void operator*=(const TMatrix< T > &Other)
Definition Matrix.inl:58
TMatrix< T > operator*(const TMatrix< T > &Other) const
Definition Matrix.inl:66
TVector< T > InverseTransformPosition(const TVector< T > &V) const
Definition Matrix.inl:191
void SetOrigin(const TVector< T > &NewOrigin)
Definition Matrix.inl:701
void SetAxes(const TVector< T > *Axis0=NULL, const TVector< T > *Axis1=NULL, const TVector< T > *Axis2=NULL, const TVector< T > *Origin=NULL)
Definition Matrix.inl:710
T RotDeterminant() const
Definition Matrix.inl:344
TPlane< T > TransformByUsingAdjointT(const TMatrix< T > &M, T DetM, const TMatrix< T > &TA) const
Definition Matrix.inl:923
TPlane< T > TransformBy(const TMatrix< T > &M) const
Definition Matrix.inl:915
T Z
Definition Vector.h:68
T Y
Definition Vector.h:65
T X
Definition Vector.h:62
TVector< T > GetSafeNormal(T Tolerance=UE_SMALL_NUMBER, const TVector< T > &ResultIfZero=ZeroVector) const
Definition Vector.h:2060
Definition UnrealMathFPU.h:20