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

Method FBin

Source/PCGExtendedToolkit/Private/Layout/PCGExBinPacking.cpp:137–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 }
136
137 FBin::FBin(const FPCGPoint& InBinPoint, const FVector& InSeed, const TSharedPtr<FBinSplit>& InSplitter)
138 {
139 Splitter = InSplitter;
140 Seed = InSeed;
141 Bounds = PCGExMath::GetLocalBounds<EPCGExPointBoundsSource::ScaledBounds>(InBinPoint);
142
143 Transform = InBinPoint.Transform;
144 Transform.SetScale3D(FVector::OneVector); // Reset scale for later transform
145
146 MaxVolume = Bounds.GetVolume();
147 FVector FurthestLocation = InSeed;
148
149 for (int C = 0; C < 3; C++)
150 {
151 const double DistToMin = FMath::Abs(Seed[C] - Bounds.Min[C]);
152 const double DistToMax = FMath::Abs(Seed[C] - Bounds.Max[C]);
153 FurthestLocation[C] = (DistToMin > DistToMax) ? Bounds.Min[C] : Bounds.Max[C];
154 }
155
156 MaxDist = FVector::DistSquared(FurthestLocation, Seed);
157
158 AddSpace(Bounds);
159 }
160
161 int32 FBin::GetBestSpaceScore(const FItem& InItem, double& OutScore, FRotator& OutRotator) const
162 {

Callers

nothing calls this directly

Calls 1

AbsFunction · 0.85

Tested by

no test coverage detected