28 template<
typename RealType,
typename VectorType,
bool bLoop>
52 template<
typename RealType,
typename VectorType,
bool bLoop>
69 template<
typename RealType,
typename VectorType>
85 template<
typename RealType,
typename VectorType,
bool bLoop>
88 VectorType Prev,
Next;
96 template<
typename RealType,
typename VectorType>
110 template<
typename RealType,
typename VectorType,
bool bLoop>
131 template<
typename RealType,
typename VectorType>
135 int N = Vertices.
Num();
144 Area += V1.X * V2.Y - V1.Y * V2.X;
146 return static_cast<RealType
>(
Area * 0.5);
152 template<
typename RealType,
typename VectorType>
156 int N = Vertices.
Num();
157 VectorType
A = Vertices[N-1] -
QueryPoint,
B = VectorType::Zero();
158 for (
int Idx = 0; Idx < N; ++Idx)
165 return Sum / FMathd::TwoPi;
172 template<
typename RealType,
typename VectorType>
177 int N = Vertices.
Num();
182 VectorType
A = Vertices[N - 1],
B = VectorType::Zero();
183 for (
int Idx = 0; Idx < N; ++Idx)
212 template<
typename RealType,
typename VectorType>
216 for (
int i = 1; i <
NV; ++i)
218 Sum +=
Distance(Vertices[i], Vertices[i-1]);
227 template<
typename RealType,
typename VectorType>
232 int N = Vertices.
Num();
233 for (
int i = 0; i < N; ++i )
253 template<
typename RealType,
typename VectorType,
bool bLoop = true,
int ClipDims = 2>
278 if constexpr (!bLoop)
328 template<
typename RealType,
typename VectorType,
bool bLoop = true>
332 bool bWasClipped =
false;
347 if constexpr (!bLoop)
395 template<
typename RealType,
typename VectorType>
405 VectorType
FromPrev = Vertices[N - 1] - Vertices[N - 2];
421 VectorType
ToNext = Vertices[
Next] - Vertices[Cur];
450 template<
typename RealType>
480 template<
typename RealType,
typename VectorType>
483 int N = Vertices.
Num();
486 for (
int Iter = 0; Iter < NumIterations; ++Iter)
488 for (
int ii = StartIdx;
ii < EndIdx; ++
ii)
495 Vertices[i] = (1 -
Alpha) * Vertices[i] + (
Alpha) * c;
501 for (
int Iter = 0; Iter < NumIterations; ++Iter)
503 for (
int i = StartIdx; i < EndIdx; ++i)
505 if (i == 0 || i >= N - 1)
511 Vertices[i] = (1 -
Alpha) * Vertices[i] + (
Alpha) * c;
522 template<
typename RealType,
typename VectorType>
525 int N = Vertices.
Num();
531 for (
int Iter = 0; Iter < NumIterations; ++Iter)
533 for (
int ii = StartIdx;
ii < EndIdx; ++
ii)
542 for (
int ii = StartIdx;
ii < EndIdx; ++
ii)
551 for (
int Iter = 0; Iter < NumIterations; ++Iter)
553 for (
int i = StartIdx; i < EndIdx && i < N; ++i)
555 if (i == 0 || i == N - 1)
563 for (
int i = StartIdx; i < EndIdx && i < N; ++i)
565 if (i == 0 || i == N - 1)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
int prev(int i, int n)
Definition RecastMesh.cpp:163
int next(int i, int n)
Definition RecastMesh.cpp:164
Definition ArrayView.h:139
UE_FORCEINLINE_HINT constexpr SizeType Num() const
Definition ArrayView.h:380
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void SetNumZeroed(SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2340
UE_REWRITE bool IsEmpty() const
Definition Array.h:1133
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition MathUtil.h:150
static RealType Atan2(const RealType ValueY, const RealType ValueX)
Definition MathUtil.h:360
bool ProjectPointInsideConvexPolygon(const TArrayView< const TVector2< RealType > > Vertices, TVector2< RealType > &ProjPt, bool bReverseOrientation=false)
Definition CurveUtil.h:451
int FindNearestIndex(const TArrayView< const VectorType > &Vertices, const VectorType &V)
Definition CurveUtil.h:228
VectorType GetNormal_FaceAvg2(const TArrayView< const VectorType > &Vertices, int VertexIndex)
Definition CurveUtil.h:111
bool IsConvex2(const TArrayView< const VectorType > Vertices, RealType Tolerance=TMathUtil< RealType >::ZeroTolerance, bool bDegenerateIsConvex=true)
Definition CurveUtil.h:396
RealType WindingIntegral2(const TArrayView< const VectorType > &Vertices, const VectorType &QueryPoint)
Definition CurveUtil.h:153
RealType SignedArea2(const TArrayView< const VectorType > &Vertices)
Definition CurveUtil.h:132
void GetVectorsToPrevNext(const TArrayView< const VectorType > &Vertices, int32 VertexIndex, VectorType &OutToPrev, VectorType &OutToNext, bool bNormalize)
Definition CurveUtil.h:53
void GetPrevNext(const TArrayView< const VectorType > &Vertices, int32 Idx, VectorType &OutPrev, VectorType &OutNext)
Definition CurveUtil.h:29
bool Contains2(const TArrayView< const VectorType > &Vertices, const VectorType &QueryPoint)
Definition CurveUtil.h:173
void InPlaceSmooth(TArrayView< VectorType > Vertices, int StartIdx, int EndIdx, double Alpha, int NumIterations, bool bClosed)
Definition CurveUtil.h:481
void IterativeSmooth(TArrayView< VectorType > Vertices, int StartIdx, int EndIdx, double Alpha, int NumIterations, bool bClosed)
Definition CurveUtil.h:523
constexpr UE::Math::TVector2< T > PerpCW(const UE::Math::TVector2< T > &V)
Definition VectorTypes.h:26
T DistanceSquared(const UE::Math::TVector2< T > &V1, const UE::Math::TVector2< T > &V2)
Definition VectorTypes.h:82
T SignedAngleR(const UE::Math::TVector2< T > &V1, const UE::Math::TVector2< T > &V2)
Definition VectorTypes.h:110
T Orient(const UE::Math::TVector2< T > &A, const UE::Math::TVector2< T > &B, const UE::Math::TVector2< T > &C)
Definition VectorTypes.h:33
@ Area
Definition FitOrientedBox2.h:17
T Normalize(UE::Math::TVector2< T > &Vector, const T Epsilon=0)
Definition VectorTypes.h:46
Definition AdvancedWidgetsModule.cpp:13