public void CanDetectEndPointSegmentIntersection()
        {
            IPolyline polyline1 = CreatePolyline(
                CreatePoint(0, 0),
                CreatePoint(100, 100));
            IPolyline polyline2 = CreatePolyline(
                CreatePoint(100, 0),
                CreatePoint(50.001, 50));

            const bool reportOverlaps = false;

            Assert.IsTrue(HasInvalidIntersection(polyline1, polyline2,
                                                 AllowedEndpointInteriorIntersections.None,
                                                 reportOverlaps,
                                                 _tolerance));

            IMultipoint intersections = LineIntersectionUtils.GetInvalidIntersections(
                polyline1, polyline2,
                AllowedEndpointInteriorIntersections.None,
                AllowedLineInteriorIntersections.None,
                reportOverlaps,
                _tolerance);

            Assert.AreEqual(1, GeometryUtils.GetPointCount(intersections));
            AssertPoint(intersections, 0, CreatePoint(50.001, 50));
        }
        public void CanDetectLinearIntersectionAndCrossing()
        {
            IPolyline polyline1 = CreatePolyline(
                CreatePoint(0, 0),
                CreatePoint(100, 100));
            IPolyline polyline2 = CreatePolyline(
                CreatePoint(100, 0),
                CreatePoint(49, 49),
                CreatePoint(51, 51),
                CreatePoint(0, 100),
                CreatePoint(10, 0));

            const bool reportOverlaps = true;

            Assert.IsTrue(HasInvalidIntersection(polyline1, polyline2,
                                                 AllowedEndpointInteriorIntersections.None,
                                                 reportOverlaps,
                                                 _tolerance));

            IMultipoint intersections = LineIntersectionUtils.GetInvalidIntersections(
                polyline1, polyline2,
                AllowedEndpointInteriorIntersections.None,
                AllowedLineInteriorIntersections.None,
                reportOverlaps,
                _tolerance);

            Assert.AreEqual(3, GeometryUtils.GetPointCount(intersections));
            AssertPoint(intersections, 0, CreatePoint(9.0918, 9.0916));
            AssertPoint(intersections, 1, CreatePoint(49, 49));
            AssertPoint(intersections, 2, CreatePoint(51, 51));
        }
        private bool HasInvalidIntersection(
            [NotNull] IPolyline polyline1,
            [NotNull] IPolyline polyline2,
            AllowedEndpointInteriorIntersections allowedEndpointInteriorIntersections,
            bool reportOverlaps,
            double vertexSearchDistance)
        {
            IPoint outPoint;

            return(LineIntersectionUtils.HasInvalidIntersection(
                       polyline1, polyline2,
                       allowedEndpointInteriorIntersections,
                       reportOverlaps,
                       _pointTemplate1,
                       _pointTemplate2,
                       vertexSearchDistance,
                       out outPoint));
        }