コード例 #1
0
        public void FullEarthRectContainsSegmentCrossingPrimeMeridian()
        {
            Rect fullEarth = GetFullEarthRect();

            GeoCoordinates segA = new GeoCoordinates(-10, 170);
            GeoCoordinates segB = new GeoCoordinates(10, 190);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, fullEarth, 0));
        }
コード例 #2
0
        public void FullEarthRectContainsAverageSegment()
        {
            Rect fullEarth = GetFullEarthRect();

            GeoCoordinates segA = new GeoCoordinates(0, -10);
            GeoCoordinates segB = new GeoCoordinates(10, 10);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, fullEarth, 0));
        }
コード例 #3
0
        public void GeoRectIsWithinDistanceOfSegment()
        {
            Rect rect = new Rect
            {
                xMin = -10,
                xMax = 10,
                yMin = -10,
                yMax = 10
            };

            GeoCoordinates segA = new GeoCoordinates(11, -20);
            GeoCoordinates segB = new GeoCoordinates(11, 20);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, rect, 1 + 1e-10));
        }
コード例 #4
0
        public void GeoRectIsNearSegmentThatIntersectsItsEdge()
        {
            Rect rect = new Rect
            {
                xMin = -10,
                xMax = 10,
                yMin = -10,
                yMax = 10
            };

            GeoCoordinates segA = new GeoCoordinates(0, -20);
            GeoCoordinates segB = new GeoCoordinates(0, 20);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, rect, 0));
        }
コード例 #5
0
        public void GeoRectIsNearSegmentItContains()
        {
            Rect rect = new Rect
            {
                xMin = -10,
                xMax = 10,
                yMin = -10,
                yMax = 10
            };

            GeoCoordinates segA = new GeoCoordinates(-1, 0);
            GeoCoordinates segB = new GeoCoordinates(1, 0);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, rect, 0));
        }
コード例 #6
0
        public void RectNearSegmentWorksWithRectCrossingPrimeMeridian2()
        {
            Rect rect = new Rect
            {
                xMin = -185,
                xMax = -175,
                yMin = -10,
                yMax = 10
            };

            GeoCoordinates segA = new GeoCoordinates(-30, -177);
            GeoCoordinates segB = new GeoCoordinates(30, -177);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, rect, 0));
        }
コード例 #7
0
        public void SmallRectContainsSegmentCrossingPrimeMeridianOnOppositeSide()
        {
            Rect rect = new Rect
            {
                xMin = -181,
                xMax = -179,
                yMin = 10,
                yMax = 13
            };

            GeoCoordinates segA = new GeoCoordinates(11, 170);
            GeoCoordinates segB = new GeoCoordinates(11, 190);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.True(GeoRectUtils.RectNearSegment(seg, rect, 0));
        }
コード例 #8
0
        public void RectIsntNearSegment()
        {
            Rect rect = new Rect
            {
                xMin = -10,
                xMax = 10,
                yMin = -10,
                yMax = 10
            };

            GeoCoordinates segA = new GeoCoordinates(11, -20);
            GeoCoordinates segB = new GeoCoordinates(11, 20);
            GeoSegment     seg  = new GeoSegment(segA, segB);

            Assert.False(GeoRectUtils.RectNearSegment(seg, rect, 0.5));
        }