public Stats GetFacetStats() { var sourceLength = AcadHelpers.GetCurveLength(sourceCurve); return(new Stats { SourceLength = sourceLength, TargetLength = AcadHelpers.GetCurveLength(targetCurve), SourceFacetLengths = GetSourceFacetLengts(sourceLength).ToList() }); }
public Point3d[] Project() { var sourceLength = AcadHelpers.GetCurveLength(sourceCurve); var targetLength = AcadHelpers.GetCurveLength(targetCurve); var adjustment = targetLength - sourceLength; var targetNotches = new List <Point3d>(); double accumulatedAdjustment = 0; foreach (var(sourceNotch, adjustmentFractionPercentage) in sourceNotches.Zip(TargetFacetAdjustmentPercentages, (notch, adj) => (notch, adj))) { var sourceFacetDist = sourceCurve.GetDistAtPoint(sourceNotch); accumulatedAdjustment += adjustment * adjustmentFractionPercentage / 100.0; var targetFacetDist = sourceFacetDist + accumulatedAdjustment; if (IsInverted) { targetFacetDist = targetLength - targetFacetDist; } // Check if the target notch point is still on the curve, .GetPointAtDist will fail otherwise if (targetFacetDist <= targetLength) { var targetNotch = targetCurve.GetPointAtDist(targetFacetDist); targetNotches.Add(targetNotch); } else { logger.Warn($"Target notch point at {targetFacetDist:N2} exceeds target curve length of {targetLength:N2} and can't be set"); } } return(targetNotches.ToArray()); }