Exemplo n.º 1
0
        public void BottomObstacleTest()
        {
            // Create a rectangle object with 4 equal sides to check openess score
            Point   origin  = Point.ByCoordinates(0, -10);
            Surface surface = Surface.ByPatch(Rectangle.ByWidthLength(CoordinateSystem.ByOrigin(origin), 10, 10));

            // Calculate openess score
            double openessScore = Openess.FromSurface(surface, 0, new List <Polygon> {
            }, new List <Polygon> {
                obstacle
            });

            // Check of score equals 0.25, as the entire bottom is blocked by the obstacle
            Assert.AreEqual(0.25, openessScore);

            // Dispose unused geometry
            obstacle.Dispose();
            origin.Dispose();
        }
Exemplo n.º 2
0
        public void RightObstacleTest()
        {
            // Create a rectangle object with 4 equal sides to check openess score
            var origin  = Point.ByCoordinates(10, 0);
            var surface = Surface.ByPatch(Rectangle.ByWidthLength(CoordinateSystem.ByOrigin(origin), 10, 10));

            // Calculate openess score
            var openessScore = Openess.FromSurface(surface, 0, new List <Polygon> {
            }, new List <Polygon> {
                obstacle
            });

            // Check of score equals 75%, as the entire right side is blocked by the obstacle
            Assert.AreEqual(75d, openessScore);

            // Dispose unused geometry
            obstacle.Dispose();
            origin.Dispose();
        }
Exemplo n.º 3
0
        public void ObstacleOnBothSides()
        {
            List <Polygon> obstaclePolygons = new List <Polygon>()
            {
                obstacle.Translate(-10) as Polygon,
                obstacle.Translate(10) as Polygon
            };

            // Create a rectangle object with 4 equal sides to check openess score
            Surface surface = Surface.ByPatch(Rectangle.ByWidthLength(10, 10));

            // Calculate openess score
            double openessScore = Openess.FromSurface(surface, 0, new List <Polygon> {
            }, obstaclePolygons);

            // Check if score equals 0.50, as the entire right and left side is blocked by the obstacles
            Assert.AreEqual(0.50, openessScore);

            // Dispose unused geometry
            obstaclePolygons.ForEach(poly => poly.Dispose());
        }