MCPcopy Create free account
hub / github.com/PCGEx/PCGExtendedToolkit / NRM

Function NRM

Source/PCGExtendedToolkit/Private/PCGExDataMath.cpp:8–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6namespace PCGExMath
7{
8 FVector NRM(
9 const int32 A, const int32 B, const int32 C,
10 const TArray<FVector>& InPositions,
11 const PCGExData::TBuffer<FVector>* UpVectorCache,
12 const FVector& UpVector)
13 {
14 const FVector VA = *(InPositions.GetData() + A);
15 const FVector VB = *(InPositions.GetData() + B);
16 const FVector VC = *(InPositions.GetData() + C);
17
18 FVector UpAverage = UpVector;
19 if (UpVectorCache)
20 {
21 UpAverage += UpVectorCache->Read(A);
22 UpAverage += UpVectorCache->Read(B);
23 UpAverage += UpVectorCache->Read(C);
24 UpAverage /= 3;
25 UpAverage = UpAverage.GetSafeNormal();
26 }
27
28 return FMath::Lerp(GetNormal(VA, VB, VB + UpAverage), GetNormal(VB, VC, VC + UpAverage), 0.5).GetSafeNormal();
29 }
30}

Callers

nothing calls this directly

Calls 3

GetNormalFunction · 0.85
LerpFunction · 0.50
ReadMethod · 0.45

Tested by

no test coverage detected