Example #1
0
        public void FloorWithAddedOpenings()
        {
            this.Name = "FloorWithAddedOpenings";

            var p      = Polygon.L(10, 20, 5);
            var floor1 = new Floor(p, 0.1, new Transform(0, 0, 0.5), material: new Material("green", Colors.Green, 0.0f, 0.0f));

            var transRotate = new Transform();

            transRotate.Rotate(Vector3.ZAxis, 20.0);
            transRotate.Move(new Vector3(0, 0, 2));
            var floor2 = new Floor(p, 0.1, transRotate, material: new Material("blue", Colors.Blue, 0.0f, 0.0f));

            floor1.AddOpening(1, 1, 1, 1);
            floor1.AddOpening(3, 3, 1, 3);

            floor2.AddOpening(1, 1, 1, 1);
            floor2.AddOpening(3, 3, 1, 3);

            Assert.Equal(0.5, floor1.Elevation);
            Assert.Equal(0.1, floor1.Thickness);
            Assert.Equal(0.5, floor1.Transform.Origin.Z);

            floor1.UpdateRepresentations();
            Assert.Single(floor1.GetCsgSolids());
            Assert.Equal(25, floor1.GetFinalCsgFromSolids().Polygons.Count);

            floor2.UpdateRepresentations();
            Assert.Single(floor2.GetCsgSolids());
            Assert.Equal(8, floor2.GetFinalCsgFromSolids().Polygons.Count);

            this.Model.AddElements(new[] { floor1, floor2 });
        }
Example #2
0
        public void Floor()
        {
            this.Name = "Elements_Floor";

            // <example>
            // Create a floor with no elevation.
            var p      = Polygon.L(10, 20, 5);
            var floor1 = new Floor(p, 0.1);

            // Create a floor with an elevation.
            var floor2 = new Floor(p, 0.1, new Transform(0, 0, 3));

            // Create some openings.
            floor1.AddOpening(1, 1, 1, 1);
            floor1.AddOpening(3, 3, 1, 3);
            // </example>

            Assert.Equal(0.0, floor1.Elevation);
            Assert.Equal(0.1, floor1.Thickness);
            Assert.Equal(0.0, floor1.Transform.Origin.Z);

            this.Model.AddElement(floor1);
            this.Model.AddElement(floor2);
        }