예제 #1
0
        public void ViewsToOutsideDicionaryOutputTest()
        {
            // Result of ViewsToOutside.ByLineSegments
            var result = ViewsToOutside.ByLineSegments(lines, origin, boundaryPoly, new List <Polygon> {
            });

            // Check if output of node is a Dictionary that contains both the
            // "score" and "segments" key
            Assert.IsTrue(result.Keys.Contains("score"));
            Assert.IsTrue(result.Keys.Contains("segments"));
        }
예제 #2
0
        public void CheckIfOutputScoreIsCorrectWithNoObstrutions()
        {
            // Result of ViewsToOutside.ByLineSegments
            var result = ViewsToOutside.ByLineSegments(lines, origin, boundaryPoly, new List <Polygon> {
            });

            // Check if the score output is 1.0
            // as there are no obstacles blocking the views to outside
            var viewScore = (double)result["score"];

            Assert.AreEqual(1.0, viewScore);
        }
예제 #3
0
        public void CheckIfViewsToOutsideDetectsObstaclesInLayout()
        {
            Polygon internalPoly = Rectangle.ByWidthLength(5, 5) as Polygon;
            Point   newOrigin    = origin.Translate(10) as Point;
            // Result of ViewsToOutside.ByLineSegments
            var result = ViewsToOutside.ByLineSegments(lines, newOrigin, boundaryPoly, new List <Polygon> {
                internalPoly
            });

            var viewScore = (double)result["score"];

            Assert.AreNotEqual(1.0, viewScore);
        }