private static void GetClosePart([NotNull] SegmentProxy neighbor, [NotNull] IPnt near, double searchDistanceSquared, bool is3D, out double min, out double max) { IList <double[]> limits; Pnt p = Pnt.Create(near); 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); }
protected override bool VerifyContinue(SegmentProxy seg0, SegmentProxy seg1, SegmentNeighbors processed1, SegmentParts partsOfSeg0, bool coincident) { TryAssignComplete(seg1, processed1, partsOfSeg0); SegmentParts coincidentPartsOfSeg0; var key = new SegmentPart(seg0, 0, 1, true); if (!_coincidentParts.TryGetValue(key, out coincidentPartsOfSeg0)) { coincidentPartsOfSeg0 = new SegmentParts(); _coincidentParts.Add(key, coincidentPartsOfSeg0); } if (coincident) { partsOfSeg0.IsComplete = true; coincidentPartsOfSeg0.Add(key); return(false); } //return true; IBox seg0Box = seg0.Extent; seg0Box = new Box(Pnt.Create(seg0Box.Min), Pnt.Create(seg0Box.Max)); if (_coincidenceTolerance > 0) { seg0Box.Min.X -= _coincidenceTolerance; seg0Box.Min.Y -= _coincidenceTolerance; seg0Box.Max.X += _coincidenceTolerance; seg0Box.Max.Y += _coincidenceTolerance; } if (!seg0Box.Intersects(seg1.Extent)) { return(true); } var cap = new RoundCap(); NearSegment hullStart; NearSegment hullEnd; bool isCoincident; IList <double[]> limits = FindNeighborhood( new SegmentHull(seg0, 0, cap, cap), new SegmentHull(seg1, _coincidenceTolerance, cap, cap), _is3D, 0, out hullStart, out hullEnd, out isCoincident); IList <SegmentPart> addParts = GetSegmentParts(seg0, seg1, limits, isCoincident); coincidentPartsOfSeg0.AddRange(addParts); bool isComplete = SegmentPart.VerifyComplete(coincidentPartsOfSeg0); partsOfSeg0.IsComplete = isComplete; return(!isComplete); }
private static Pnt CreatePoint(double x, double y) { Pnt p = Pnt.Create(2); p.X = x; p.Y = y; return(p); }