Example #1
0
        public void PointWithin()
        {
            var polygons = new List <Polygon>
            {
                new Polygon
                (
                    new []
                {
                    new Vector3(),
                    new Vector3(8.0, 0.0),
                    new Vector3(8.0, 9.0),
                    new Vector3(0.0, 9.0)
                }
                ),
                new Polygon
                (
                    new []
                {
                    new Vector3(52.0, 0.0),
                    new Vector3(60.0, 0.0),
                    new Vector3(60.0, 6.0),
                    new Vector3(52.0, 6.0)
                }
                ),
                new Polygon
                (
                    new []
                {
                    new Vector3(24.0, 33.0),
                    new Vector3(32.0, 33.0),
                    new Vector3(32.0, 36.0),
                    new Vector3(24.0, 36.0)
                }
                )
            };
            var point1 = new Vector3(-1.1, -1.1);
            var point2 = new Vector3(26.2, 34.2);
            var point3 = new Vector3(54.5, 3.3);

            Assert.False(Shaper.PointWithin(point1, polygons));
            Assert.True(Shaper.PointWithin(point2, polygons));
            Assert.True(Shaper.PointWithin(point3, polygons));
        }