public IntersectionPoint3D( [NotNull] Pnt3D point, double virtualRingVertexIndex, SegmentIntersection segmentIntersection = null, IntersectionPointType type = IntersectionPointType.Unknown) { Point = point; VirtualSourceVertex = virtualRingVertexIndex; SegmentIntersection = segmentIntersection; Type = type; }
private static double CalculateVirtualTargetVertex(ISegmentList targetSegments, IntersectionPointType intersectionType, SegmentIntersection segmentIntersection, out int targetPartIndex) { int targetSegmentIndex = targetSegments.GetLocalSegmentIndex( segmentIntersection.TargetIndex, out targetPartIndex); double result; switch (intersectionType) { case IntersectionPointType.LinearIntersectionStart: result = targetSegmentIndex + segmentIntersection.GetRatioAlongTargetLinearStart(); break; case IntersectionPointType.LinearIntersectionEnd: case IntersectionPointType.LinearIntersectionIntermediate: result = targetSegmentIndex + segmentIntersection.GetRatioAlongTargetLinearEnd(); break; case IntersectionPointType.Crossing: case IntersectionPointType.TouchingInPoint: result = targetSegmentIndex + segmentIntersection.GetIntersectionPointFactorAlongTarget(); break; default: throw new InvalidOperationException( $"Unsupported type :{intersectionType}"); } return(result); }