Esempio n. 1
0
		public void MirrorTests()
		{
			{
				Box leftBox = new Box(10, 20, 30, "leftBox", createCentered: false);
				CsgObject rightBox = new Box(11, 21, 31, "rightBox", createCentered: false);
				rightBox = new Align(rightBox, Face.Left, leftBox, Face.Right);
				CsgObject union = new Union(leftBox, rightBox);
				Assert.IsTrue(union.XSize == 21, "Correct XSize");
				AxisAlignedBoundingBox unionBounds = union.GetAxisAlignedBoundingBox();
				Assert.IsTrue(unionBounds.minXYZ == new Vector3(), "MinXYZ at 0");
				Assert.IsTrue(union.GetAxisAlignedBoundingBox().maxXYZ == new Vector3(21, 21, 31), "MaxXYZ correct");
			}

			{
				Box leftBox = new Box(10, 20, 30, "leftBox", createCentered: false);
				CsgObject rightBox = leftBox.NewMirrorAccrossX(name: "rightBox");
				rightBox = new Align(rightBox, Face.Left, leftBox, Face.Right);
				CsgObject union = new Union(leftBox, rightBox);
				Assert.IsTrue(union.XSize == 20, "Correct XSize");
				AxisAlignedBoundingBox unionBounds = union.GetAxisAlignedBoundingBox();
				Assert.IsTrue(unionBounds.minXYZ == new Vector3(), "MinXYZ at 0");
				Assert.IsTrue(union.GetAxisAlignedBoundingBox().maxXYZ == new Vector3(20, 20, 30), "MaxXYZ correct");
			}

			{
				Box frontBox = new Box(10, 20, 30, createCentered: false);
				CsgObject backBox = frontBox.NewMirrorAccrossY();
				backBox = new Align(backBox, Face.Front, frontBox, Face.Back);
				CsgObject union = new Union(frontBox, backBox);
				Assert.IsTrue(union.YSize == 40, "Correct YSize");
				AxisAlignedBoundingBox unionBounds = union.GetAxisAlignedBoundingBox();
				Assert.IsTrue(unionBounds.minXYZ == new Vector3(), "MinXYZ at 0");
				Assert.IsTrue(union.GetAxisAlignedBoundingBox().maxXYZ == new Vector3(10, 40, 30), "MaxXYZ correct");
			}
		}