UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RotationAboutPointMatrix.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Math/Vector.h"
7#include "Math/Matrix.h"
8#include "Math/Quat.h"
10
11namespace UE {
12namespace Math {
13
15template<typename T>
18{
19public:
21
28 [[nodiscard]] TRotationAboutPointMatrix(const TRotator<T>& Rot, const TVector<T>& Origin);
29
30 // Conversion to other type.
31 template<typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
36
38 [[nodiscard]] static TMatrix<T> Make(const TRotator<T>& Rot, const TVector<T>& Origin)
39 {
40 return TRotationAboutPointMatrix(Rot, Origin);
41 }
42
44 [[nodiscard]] static TMatrix<T> Make(const TQuat<T>& Rot, const TVector<T>& Origin)
45 {
46 return TRotationAboutPointMatrix(Rot.Rotator(), Origin);
47 }
48};
49
50template<typename T>
52 : TRotationTranslationMatrix<T>(Rot, Origin)
53{
54 // FRotationTranslationMatrix generates R * T.
55 // We need -T * R * T, so prepend that translation:
56 TVector<T> XAxis(M[0][0], M[1][0], M[2][0]);
57 TVector<T> YAxis(M[0][1], M[1][1], M[2][1]);
58 TVector<T> ZAxis(M[0][2], M[1][2], M[2][2]);
59
60 M[3][0] -= XAxis | Origin;
61 M[3][1] -= YAxis | Origin;
62 M[3][2] -= ZAxis | Origin;
63}
64
65} // namespace Math
66} // namespace UE
67
69
70template<> struct TIsUECoreVariant<FRotationAboutPointMatrix44f> { enum { Value = true }; };
71template<> struct TIsUECoreVariant<FRotationAboutPointMatrix44d> { enum { Value = true }; };
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
Definition AdvancedWidgetsModule.cpp:13
Definition IsUECoreType.h:19
@ Value
Definition IsUECoreType.h:20
Definition Matrix.h:43
T M[4][4]
Definition Matrix.h:49
Definition Quat.h:39
Definition RotationAboutPointMatrix.h:18
static TMatrix< T > Make(const TRotator< T > &Rot, const TVector< T > &Origin)
Definition RotationAboutPointMatrix.h:38
TRotationAboutPointMatrix(const TRotationAboutPointMatrix< FArg > &From)
Definition RotationAboutPointMatrix.h:32
TRotationAboutPointMatrix(const TRotator< T > &Rot, const TVector< T > &Origin)
Definition RotationAboutPointMatrix.h:51
static TMatrix< T > Make(const TQuat< T > &Rot, const TVector< T > &Origin)
Definition RotationAboutPointMatrix.h:44
Definition RotationTranslationMatrix.h:17
Definition Rotator.h:37
Definition Vector.h:51