private static void GetClosePart([NotNull] SegmentProxy neighbor, [NotNull] IIndexedSegments geom, [NotNull] SegmentPart segPart, double searchDistanceSquared, bool is3D, out double min, out double max) { SegmentProxy part = geom.GetSegment(segPart.PartIndex, segPart.SegmentIndex); IPnt start = part.GetPointAt(segPart.MinFraction); double minStart, maxStart; GetClosePart(neighbor, start, searchDistanceSquared, is3D, out minStart, out maxStart); IPnt end = part.GetPointAt(segPart.MaxFraction); double minEnd, maxEnd; GetClosePart(neighbor, end, searchDistanceSquared, is3D, out minEnd, out maxEnd); min = Math.Min(minStart, minEnd); max = Math.Max(maxStart, maxEnd); }
private static void GetClosePart([NotNull] SegmentProxy neighbor, [NotNull] IPnt near, double searchDistanceSquared, bool is3D, out double min, out double max) { Pnt p = Pnt.Create(near); IList <double[]> limits; bool cut = SegmentUtils.CutCurveCircle(neighbor, p, searchDistanceSquared, is3D, out limits); if (cut == false || limits.Count == 0) { min = SegmentUtils.GetClosestPointFraction(neighbor, p, is3D); max = min; } else { min = double.MaxValue; max = double.MinValue; foreach (double[] limit in limits) { foreach (double d in limit) { min = Math.Min(d, min); max = Math.Max(d, max); } } } min = Math.Max(min, 0); max = Math.Max(max, 0); min = Math.Min(min, 1); max = Math.Min(max, 1); }