| 114 | namespace PCGExBevelPath |
| 115 | { |
| 116 | FBevel::FBevel(const int32 InIndex, const FProcessor* InProcessor): |
| 117 | Index(InIndex) |
| 118 | { |
| 119 | const TArray<FPCGPoint>& InPoints = InProcessor->PointDataFacade->GetIn()->GetPoints(); |
| 120 | ArriveIdx = Index - 1 < 0 ? InPoints.Num() - 1 : Index - 1; |
| 121 | LeaveIdx = Index + 1 == InPoints.Num() ? 0 : Index + 1; |
| 122 | |
| 123 | Corner = InPoints[InIndex].Transform.GetLocation(); |
| 124 | PrevLocation = InPoints[ArriveIdx].Transform.GetLocation(); |
| 125 | NextLocation = InPoints[LeaveIdx].Transform.GetLocation(); |
| 126 | |
| 127 | // Pre-compute some data |
| 128 | |
| 129 | ArriveDir = (PrevLocation - Corner).GetSafeNormal(); |
| 130 | LeaveDir = (NextLocation - Corner).GetSafeNormal(); |
| 131 | |
| 132 | Width = InProcessor->WidthGetter->Read(Index); |
| 133 | |
| 134 | const double ArriveLen = InProcessor->Len(ArriveIdx); |
| 135 | const double LeaveLen = InProcessor->Len(Index); |
| 136 | const double SmallestLength = FMath::Min(ArriveLen, LeaveLen); |
| 137 | |
| 138 | if (InProcessor->Settings->WidthMeasure == EPCGExMeanMeasure::Relative) |
| 139 | { |
| 140 | Width *= SmallestLength; |
| 141 | } |
| 142 | |
| 143 | if (InProcessor->Settings->Mode == EPCGExBevelMode::Radius) |
| 144 | { |
| 145 | Width = Width / FMath::Sin(FMath::Acos(FVector::DotProduct(ArriveDir, LeaveDir)) / 2.0f); |
| 146 | } |
| 147 | |
| 148 | if (InProcessor->Settings->Limit != EPCGExBevelLimit::None) |
| 149 | { |
| 150 | Width = FMath::Min(Width, SmallestLength); |
| 151 | } |
| 152 | |
| 153 | ArriveAlpha = Width / ArriveLen; |
| 154 | LeaveAlpha = Width / LeaveLen; |
| 155 | } |
| 156 | |
| 157 | void FBevel::Balance(const FProcessor* InProcessor) |
| 158 | { |
nothing calls this directly
no test coverage detected