UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TransformSequence.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "TransformTypes.h"
7
8namespace UE
9{
10namespace Geometry
11{
12
13using namespace UE::Math;
14
18template<typename RealType>
20{
21protected:
23
24public:
25
33
41
52
56 int32 Num() const { return Transforms.Num(); }
57
62
63
68 {
70 {
71 if (Transform.HasNonUniformScale(Tolerance))
72 {
73 return true;
74 }
75 }
76 return false;
77 }
78
79
84
86 {
87 if (Transform.CanRepresentInverse(Tolerance))
88 {
89 Append(Transform.InverseUnsafe(Tolerance));
90 }
91 else
92 {
94 InvS.SetScale(TTransformSRT3<RealType>::GetSafeScaleReciprocal(Transform.GetScale3D(), Tolerance));
95
98 InvRT = InvRT.InverseUnsafe();
100 Append(InvS);
101 }
102 }
103
105 {
106 for (int32 Idx = Transforms.Num() - 1; Idx >= 0; --Idx)
107 {
108 AppendInverse(Transforms[Idx], Tolerance);
109 }
110 }
111
112 // Create the inverse of a transform sequence. Note: Transforms with both non-uniform scale and rotation may be split into two transforms. Zeros in scale will be replaced with unit scales.
114 {
116 for (int32 Idx = Transforms.Num() - 1; Idx >= 0; --Idx)
117 {
119 }
120 return InverseTransformSeq;
121 }
122
135
139 bool WillInvert() const
140 {
141 RealType Det = 1;
143 {
144 Det *= Transform.GetDeterminant();
145 }
146 return Det < 0;
147 }
148
153 {
155 {
157 }
158 }
159
164 {
166 {
167 P = Transform.TransformPosition(P);
168 }
169 return P;
170 }
171
176 {
177 int32 N = Transforms.Num();
178 for (int32 k = N - 1; k >= 0; k--)
179 {
180 P = Transforms[k].InverseTransformPosition(P);
181 }
182 return P;
183 }
184
189 {
191 {
192 V = Transform.TransformVector(V);
193 }
194 return V;
195 }
196
197
202 {
204 {
205 Normal = Transform.TransformNormal(Normal);
206 }
207 return Normal;
208 }
209
213 template<typename TransformsEquivalentFunc>
215 {
216 int32 N = Transforms.Num();
217 if (N == OtherSeq.Transforms.Num())
218 {
219 bool bAllTransformsEqual = true;
220 for (int32 k = 0; k < N && bAllTransformsEqual; ++k)
221 {
223 }
224 return bAllTransformsEqual;
225 }
226 return false;
227 }
228};
229
232
233
234} // end namespace UE::Geometry
235} // end namespace UE
@ Normal
Definition AndroidInputInterface.h:116
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Array.h:670
Definition MathUtil.h:150
Definition ContainerAllocationPolicies.h:894
Definition TransformTypes.h:30
static TTransformSRT3< RealType > Identity()
Definition TransformTypes.h:83
void SetScale(const UE::Math::TVector< RealType > &ScaleIn)
Definition TransformTypes.h:163
Definition TransformSequence.h:20
void AppendInverse(const TTransformSequence3< RealType > &SequenceToAppend, const RealType Tolerance=TMathUtil< RealType >::ZeroTolerance)
Definition TransformSequence.h:104
void ClearScales()
Definition TransformSequence.h:152
void AppendInverse(const FTransform &Transform, const RealType Tolerance=TMathUtil< RealType >::ZeroTolerance)
Definition TransformSequence.h:80
TVector< RealType > GetAccumulatedScale() const
Definition TransformSequence.h:126
bool IsEquivalent(const TTransformSequence3< RealType > &OtherSeq, TransformsEquivalentFunc TransformsTest) const
Definition TransformSequence.h:214
TVector< RealType > TransformPosition(UE::Math::TVector< RealType > P) const
Definition TransformSequence.h:163
TVector< RealType > InverseTransformPosition(UE::Math::TVector< RealType > P) const
Definition TransformSequence.h:175
TVector< RealType > TransformNormal(UE::Math::TVector< RealType > Normal) const
Definition TransformSequence.h:201
void AppendInverse(const TTransformSRT3< RealType > &Transform, const RealType Tolerance=TMathUtil< RealType >::ZeroTolerance)
Definition TransformSequence.h:85
void Append(const TTransformSequence3< RealType > &SequenceToAppend)
Definition TransformSequence.h:45
int32 Num() const
Definition TransformSequence.h:56
bool WillInvert() const
Definition TransformSequence.h:139
bool HasNonUniformScale(RealType Tolerance=TMathUtil< RealType >::ZeroTolerance) const
Definition TransformSequence.h:67
void Append(const TTransformSRT3< RealType > &Transform)
Definition TransformSequence.h:29
const TArray< TTransformSRT3< RealType >, TInlineAllocator< 2 > > & GetTransforms() const
Definition TransformSequence.h:61
void Append(const FTransform &Transform)
Definition TransformSequence.h:37
TVector< RealType > TransformVector(UE::Math::TVector< RealType > V) const
Definition TransformSequence.h:188
TArray< TTransformSRT3< RealType >, TInlineAllocator< 2 > > Transforms
Definition TransformSequence.h:22
TTransformSequence3< RealType > GetInverse(const RealType Tolerance=TMathUtil< RealType >::ZeroTolerance) const
Definition TransformSequence.h:113
TTransformSequence3< float > FTransformSequence3f
Definition TransformSequence.h:230
TTransformSequence3< double > FTransformSequence3d
Definition TransformSequence.h:231
Definition Sphere.cpp:10
Definition AdvancedWidgetsModule.cpp:13
Definition Vector.h:51
static TVector< T > One()
Definition Vector.h:115