Example #1
0
        public Tower MakeTower()
        {
            var tower = new Tower()
            {
                Color       = Palette.Aqua,
                Elevation   = -8.0,
                Floors      = 20,
                HeightLimit = 80.0,
                Perimeter   = Shaper.Rectangle(60.0, 20.0),
                StoryHeight = 4.0,
                TargetArea  = 24000.0
            };

            tower.Stack();
            var entry = new Room()
            {
                Height = 6.0
            };

            tower.SetStoryHeight(0, 8.0);
            tower.Stories[0].Color = Palette.Granite;
            entry.SetPerimeter(new Vector3(30.0, -0.1), new Vector3(30.0, 6.0), 2.0);
            tower.Stories[1].AddCorridor(entry);
            var coreShaft = new Room()
            {
                Perimeter = Shaper.Rectangle(5.0, 8.0, new Vector3(27.5, 6.0))
            };

            for (int i = 1; i < 3; i++)
            {
                tower.Stories[i].Color = Palette.Green;
                tower.SetStoryHeight(i, 6.0);
                tower.Stories[i].RoomsByDivision(4, 1, 5.5, 0.5, "Retail", Palette.Lime);
                tower.Stories[i].AddExclusion(coreShaft);
            }
            var corridor = new Room()
            {
                Height = 3.5
            };

            corridor.SetPerimeter(new Vector3(0.5, 10.0), new Vector3(59.5, 10), 2.0);
            for (int i = 3; i < tower.Stories.Count; i++)
            {
                tower.Stories[i].RoomsByDivision(4, 2, 3.5, 0.5, "Office", Palette.Teal);
                tower.Stories[i].AddCorridor(corridor);
                tower.Stories[i].AddExclusion(coreShaft);
            }
            tower.AddCore(coreShaft.Perimeter, 0, 3.0, Palette.Granite);
            var model = new Model();

            foreach (Space space in tower.Spaces)
            {
                model.AddElement(space);
            }
            //model.ToGlTF("../../../../Tower.glb");
            return(tower);
        }
Example #2
0
        public void AreaPlaced()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2);
            Assert.Equal(1200.0, roomGroup.AreaPlaced, 10);
        }
Example #3
0
        public void RoomsByDivision()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2);
            Assert.Equal(8.0, roomGroup.Rooms.Count, 10);
        }
Example #4
0
        public void SizeXY()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            Assert.Equal(60.0, roomGroup.SizeX, 10);
            Assert.Equal(20.0, roomGroup.SizeY, 10);
        }
Example #5
0
        public void RoomsAsSpaces()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2);
            Assert.Equal(8.0, roomGroup.RoomsAsSpaces.Count, 10);
            Assert.Equal(150.0, roomGroup.RoomsAsSpaces.First().Profile.Area(), 10);
        }
Example #6
0
        public void Perimeter()
        {
            var room = new Room
            {
                Perimeter = Shaper.Rectangle(10.0, 10.0)
            };

            Assert.Contains(new Vector3(0.0, 10.0), room.Perimeter.Vertices);
            Assert.Contains(new Vector3(10.0, 10.0), room.Perimeter.Vertices);
            room.Perimeter = null;
            Assert.Contains(new Vector3(0.0, 0.0), room.Perimeter.Vertices);
            Assert.Contains(new Vector3(10.0, 0.0), room.Perimeter.Vertices);
        }
Example #7
0
        public void MoveFromTo()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.MoveFromTo(Vector3.Origin, new Vector3(20.0, 20.0, 20.0));
            Assert.Equal(20.0, roomGroup.Elevation);
            Assert.Contains(new Vector3(20.0, 20.0, 0.0), roomGroup.Perimeter.Vertices);
            Assert.Contains(new Vector3(80.0, 20.0, 0.0), roomGroup.Perimeter.Vertices);
            Assert.Contains(new Vector3(80.0, 40.0, 0.0), roomGroup.Perimeter.Vertices);
            Assert.Contains(new Vector3(20.0, 40.0, 0.0), roomGroup.Perimeter.Vertices);
        }
Example #8
0
        public void RoomGroup()
        {
            var polygon   = Shaper.Rectangle(60.0, 20.0);
            var roomGroup = new RoomGroup()
            {
                Perimeter = polygon
            };

            roomGroup.RoomsByDivision(4, 2, 3.5);
            var model = new Model();

            foreach (Room room in roomGroup.Rooms)
            {
                model.AddElement(room.AsSpace);
            }
            model.ToGlTF("../../../../RoomGroup.glb");
        }
Example #9
0
        public void SetHeight()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2, 3.0);
            foreach (Room room in roomGroup.Rooms)
            {
                Assert.Equal(3.0, room.Height, 10);
            }
            roomGroup.SetHeight(4.5);
            foreach (Room room in roomGroup.Rooms)
            {
                Assert.Equal(4.5, room.Height, 10);
            }
        }
Example #10
0
        public void SetElevation()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2);
            foreach (Room room in roomGroup.Rooms)
            {
                Assert.Equal(0.0, room.Elevation, 10);
            }
            roomGroup.Elevation = 10.2;
            foreach (Room room in roomGroup.Rooms)
            {
                Assert.Equal(10.2, room.Elevation, 10);
            }
        }
Example #11
0
        public void SetColor()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2);
            foreach (Room room in roomGroup.Rooms)
            {
                Assert.Equal(Palette.White, room.Color);
            }
            roomGroup.SetColor(Palette.Green);
            foreach (Room room in roomGroup.Rooms)
            {
                Assert.Equal(Palette.Green, room.Color);
            }
        }
Example #12
0
        public void Rotate()
        {
            var roomGroup = new RoomGroup()
            {
                Perimeter = Shaper.Rectangle(60.0, 20.0)
            };

            roomGroup.RoomsByDivision(4, 2);
            var model = new Model();

            foreach (Room room in roomGroup.Rooms)
            {
                model.AddElement(room.AsSpace);
            }
            roomGroup.Rotate(Vector3.Origin, 180);
            foreach (Room room in roomGroup.Rooms)
            {
                model.AddElement(room.AsSpace);
            }
            model.ToGlTF("../../../../RoomGroupRotate.glb");
        }