| 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 | { |