Ejemplo n.º 1
0
        public void IsovistFromPointReturnsExceptionIfOriginPointIsInsideInternalPolygonTest()
        {
            // Create obstruction
            Polygon internals = Rectangle.ByWidthLength(5, 5) as Polygon;

            // Create origin point
            Point originPoint = Point.ByCoordinates(0, 0);

            Assert.Throws <ApplicationException>(() => Isovist.FromPoint(new List <Polygon> {
                layoutPolygon
            }, new List <Polygon> {
                internals
            }, originPoint));
        }
Ejemplo n.º 2
0
        public void IsovistFromPointReturnsCorrectSurfaceAreaTest()
        {
            // Create origin point
            Point originPoint = layoutPolygon.Center();

            // Create isovist form the origin point
            Surface isovist = Isovist.FromPoint(new List <Polygon> {
                layoutPolygon
            }, new List <Polygon> {
                layoutPolygon
            }, originPoint);

            // Checks if the area of the isovist is equal to the area of the layout
            // as there are no obstructions the entire layout should be visible from the origin point
            Assert.AreEqual(isovist.Area, Surface.ByPatch(layoutPolygon).Area);
        }
Ejemplo n.º 3
0
        public void IsovistFromPointDetectsObstructionsInLayoutTest()
        {
            // Create obstruction
            Polygon internals = Rectangle.ByWidthLength(5, 5) as Polygon;

            // Create origin point
            Point originPoint = Point.ByCoordinates(3, 3);

            // Create isovist form the origin point
            Surface isovist = Isovist.FromPoint(new List <Polygon> {
                layoutPolygon
            }, new List <Polygon> {
                internals
            }, originPoint);

            // Checks that the area returned by the isovist is not equal to the area of the layout
            // and that the isovist does not intersect the midpoint of the obstacle.
            Assert.AreNotEqual(Surface.ByPatch(layoutPolygon).Area, isovist.Area);
            Assert.False(isovist.DoesIntersect(internals.Center()));
        }