Пример #1
0
        /// <summary>
        /// Gets the segment intersections between the specified path and multiline-string.
        /// </summary>
        /// <param name="segmentList1"></param>
        /// <param name="segmentList2"></param>
        /// <param name="tolerance"></param>
        /// <param name="optimizeLinearIntersections">If true, an optimiziation that improves the
        /// performance when linear intersections are present. If a segmentList1 segment is equal
        /// to a linestring2 segment it will directly be used. Other intersections will be missed.
        /// </param>
        /// <returns>The segment intersections with the index of the cut part of multiLinestring2</returns>
        public static IEnumerable <SegmentIntersection> GetSegmentIntersectionsXY(
            [NotNull] ISegmentList segmentList1,
            [NotNull] ISegmentList segmentList2,
            double tolerance,
            bool optimizeLinearIntersections = false)
        {
            if (GeomRelationUtils.AreBoundsDisjoint(segmentList1, segmentList2, tolerance))
            {
                yield break;
            }

            SegmentIntersection previousLinearIntersection = null;

            for (var lineIdx = 0; lineIdx < segmentList1.SegmentCount; lineIdx++)
            {
                Line3D line = segmentList1.GetSegment(lineIdx);

                foreach (SegmentIntersection result in GetSegmentIntersectionsXY(
                             lineIdx, line, segmentList2, tolerance,
                             previousLinearIntersection))
                {
                    if (optimizeLinearIntersections && result.SegmentsAreEqualInXy)
                    {
                        previousLinearIntersection = result;
                    }

                    yield return(result);
                }
            }
        }
Пример #2
0
 public bool ExtentIntersectsXY(
     double xMin, double yMin, double xMax, double yMax,
     double tolerance)
 {
     return(!GeomRelationUtils.AreBoundsDisjoint(XMin, YMin, XMax, YMax,
                                                 xMin, yMin, xMax, yMax,
                                                 tolerance));
 }
Пример #3
0
 public bool ExtentsIntersectXY(double otherXMin, double otherYMin,
                                double otherXMax, double otherYMax,
                                double tolerance)
 {
     return(!GeomRelationUtils.AreBoundsDisjoint(XMin, YMin, XMax, YMax,
                                                 otherXMin, otherYMin, otherXMax, otherYMax,
                                                 tolerance));
 }