/// <summary> /// This method is called by clients /// of the <see cref="ISegmentIntersector" /> class to process /// intersections for two segments of the <see cref="SegmentString" />s being intersected. /// Notice that some clients (such as <see cref="MonotoneChain" />s) may optimize away /// this call for segment pairs which they have determined do not intersect /// (e.g. by an disjoint envelope test). /// </summary> /// <param name="e0"></param> /// <param name="segIndex0"></param> /// <param name="e1"></param> /// <param name="segIndex1"></param> public void ProcessIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) { // don't bother intersecting a segment with itself if (e0 == e1 && segIndex0 == segIndex1) { return; } Coordinate p00 = e0.Coordinates[segIndex0]; Coordinate p01 = e0.Coordinates[segIndex0 + 1]; Coordinate p10 = e1.Coordinates[segIndex1]; Coordinate p11 = e1.Coordinates[segIndex1 + 1]; _li.ComputeIntersection(p00, p01, p10, p11); if (_li.HasIntersection) { if (_li.IsInteriorIntersection()) { for (int intIndex = 0; intIndex < _li.IntersectionNum; intIndex++) { _interiorIntersections.Add(_li.GetIntersection(intIndex)); } e0.AddIntersections(_li, segIndex0); e1.AddIntersections(_li, segIndex1); } } }
/// <summary> /// This method is called by clients /// of the <see cref="ISegmentIntersector" /> class to process /// intersections for two segments of the <see cref="SegmentString" /> being intersected. /// Notice that some clients (such as <see cref="MonotoneChain" />s) may optimize away /// this call for segment pairs which they have determined do not intersect /// (e.g. by an disjoint envelope test). /// </summary> /// <param name="e0"></param> /// <param name="segIndex0"></param> /// <param name="e1"></param> /// <param name="segIndex1"></param> public void ProcessIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) { if (e0 == e1 && segIndex0 == segIndex1) { return; } _numTests++; Coordinate p00 = e0.Coordinates[segIndex0]; Coordinate p01 = e0.Coordinates[segIndex0 + 1]; Coordinate p10 = e1.Coordinates[segIndex1]; Coordinate p11 = e1.Coordinates[segIndex1 + 1]; _li.ComputeIntersection(p00, p01, p10, p11); if (!_li.HasIntersection) { return; } _numIntersections++; if (_li.IsInteriorIntersection()) { NumInteriorIntersections++; _hasInterior = true; } // if the segments are adjacent they have at least one trivial intersection, // the shared endpoint. Don't bother adding it if it is the // only intersection. if (IsTrivialIntersection(e0, segIndex0, e1, segIndex1)) { return; } _hasIntersection = true; e0.AddIntersections(_li, segIndex0); e1.AddIntersections(_li, segIndex1); if (!_li.IsProper) { return; } _numProperIntersections++; _hasProper = true; _hasProperInterior = true; }
/// <summary> /// This method is called by clients /// of the <see cref="ISegmentIntersector" /> class to process /// intersections for two segments of the <see cref="SegmentString" /> being intersected. /// Notice that some clients (such as <see cref="MonotoneChain" />s) may optimize away /// this call for segment pairs which they have determined do not intersect /// (e.g. by an disjoint envelope test). /// </summary> /// <param name="e0"></param> /// <param name="segIndex0"></param> /// <param name="e1"></param> /// <param name="segIndex1"></param> public void ProcessIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) { if (e0 == e1 && segIndex0 == segIndex1) return; _numTests++; Coordinate p00 = e0.Coordinates[segIndex0]; Coordinate p01 = e0.Coordinates[segIndex0 + 1]; Coordinate p10 = e1.Coordinates[segIndex1]; Coordinate p11 = e1.Coordinates[segIndex1 + 1]; _li.ComputeIntersection(p00, p01, p10, p11); if (!_li.HasIntersection) return; _numIntersections++; if (_li.IsInteriorIntersection()) { NumInteriorIntersections++; _hasInterior = true; } // if the segments are adjacent they have at least one trivial intersection, // the shared endpoint. Don't bother adding it if it is the // only intersection. if (IsTrivialIntersection(e0, segIndex0, e1, segIndex1)) return; _hasIntersection = true; e0.AddIntersections(_li, segIndex0); e1.AddIntersections(_li, segIndex1); if (!_li.IsProper) return; _numProperIntersections++; _hasProper = true; _hasProperInterior = true; }
/// <summary> /// This method is called by clients /// of the <see cref="ISegmentIntersector" /> class to process /// intersections for two segments of the <see cref="SegmentString" />s being intersected. /// Notice that some clients (such as <see cref="MonotoneChain" />s) may optimize away /// this call for segment pairs which they have determined do not intersect /// (e.g. by an disjoint envelope test). /// </summary> /// <param name="e0"></param> /// <param name="segIndex0"></param> /// <param name="e1"></param> /// <param name="segIndex1"></param> public void ProcessIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) { // don't bother intersecting a segment with itself if (e0 == e1 && segIndex0 == segIndex1) return; Coordinate p00 = e0.Coordinates[segIndex0]; Coordinate p01 = e0.Coordinates[segIndex0 + 1]; Coordinate p10 = e1.Coordinates[segIndex1]; Coordinate p11 = e1.Coordinates[segIndex1 + 1]; _li.ComputeIntersection(p00, p01, p10, p11); if (_li.HasIntersection) { if (_li.IsInteriorIntersection()) { for (int intIndex = 0; intIndex < _li.IntersectionNum; intIndex++) _interiorIntersections.Add(_li.GetIntersection(intIndex)); e0.AddIntersections(_li, segIndex0); e1.AddIntersections(_li, segIndex1); } } }