public void Interpolation_NegativeZRotation()
        {
            var cube = new Cube(10, 5, 2).Rotate(0, 0, -95);

            //Rotating on Z axis by 90 should shift the center of the cube on the negative Y quadrant
            Assert.AreEqual(new Vector3(2.05470803149107, -5.19886284732787, 1), cube.Position());
        }
Exemple #2
0
 public void Scale_TranslateRotateScaleStillYieldsCorrectPosition()
 {
     var obj = new Cube(5, 5, 20)
            .Translate(30, 0, 0).Rotate(0, 90, 0).Scale(2, 2, 2);
     
     Assert.AreEqual(new Vector3(20, 5, -65), obj.Position());
 }
        public void Interpolation_NegativeYRotationWithWideCube()
        {
            var cube = new Cube(10, 30, 15).Rotate(0, -90, 0);

            //Rotating on Y axis by -90 should shift the center of the cube on the negative X quadrant
            Assert.AreEqual(new Vector3(-7.5, 15, 5), cube.Position());
        }
        public void Interpolation_ZRotationWithLongCube()
        {
            var cube = new Cube(10, 5, 2).Rotate(0, 0, 115);

            //Rotating on Z axis by 90 should shift the center of the cube on the negative X quadrant
            Assert.AreEqual(new Vector3(-4.37886077629512, 3.4749932808315, 1), cube.Position());
        }
        public void Interpolation_PositiveYRotationWithTallCube()
        {
            var cube = new Cube(10, 12, 23).Rotate(0, 90, 0);

            //Rotating on Y axis by 90 should shift the center of the cube on the negative Z quadrant
            Assert.AreEqual(new Vector3(11.5, 6, -5), cube.Position());
        }
        public void Interpolation_NegativeRotationOnXAxis()
        {
            var cube = new Cube(11, 11, 11).Rotate(-90, 0, 0);

            //Rotating on X axis by -90 should shift the center of the cube on the negative Z quadrant
            Assert.AreEqual(new Vector3(5.5, 5.5, -5.5), cube.Position());
        }
 public void Interpolation_RotateOnXAxis()
 {
     var cube = new Cube(9, 9, 9).Rotate(90, 0, 0);
     
     //Rotating on X axis by 90 should shift the center of the cube on the negative Y quadrant
     Assert.AreEqual(new Vector3(4.5, -4.5, 4.5), cube.Position());
 }
Exemple #8
0
        public void Mirror_SingleAxisMirrorInvertsPosition()
        {
            var cube = new Cube(5, 10, 20);
            var xMirror = cube.Clone().Mirror(1, 0, 0);
            var yMirror = cube.Clone().Mirror(0, 1, 0);
            var zMirror = cube.Clone().Mirror(0, 0, 1);

            var pos = cube.Position().Clone();
            pos.X = -pos.X;
            Assert.AreEqual(pos, xMirror.Position());

            pos = cube.Position().Clone();
            pos.Y = -pos.Y;
            Assert.AreEqual(pos, yMirror.Position());

            pos = cube.Position().Clone();
            pos.Z = -pos.Z;
            Assert.AreEqual(pos, zMirror.Position());
        }
Exemple #9
0
        public void Cube_PositionMovesWithCubeOnNegativeTranslate()
        {
            var cube = new Cube(50, 50, 50, true).Translate(-5, 0, -15);

            Assert.AreEqual(new Vector3(-5, 0, -15), cube.Position());
        }
Exemple #10
0
        public void Cube_PositionMovesWithCubeOnTranslate()
        {
            var cube = new Cube(50, 50, 50).Translate(10, 10, 0);

            Assert.AreEqual(new Vector3(35, 35, 25), cube.Position());
        }
Exemple #11
0
        public void Cube_InitialPositionIfCenteredIsOrigin()
        {
            var cube = new Cube(25, 25, 25, true);

            Assert.AreEqual(new Vector3(), cube.Position());
        }
Exemple #12
0
        public void Cube_InitialPositionForNonCenteredCubeIsHalfLengthWidthAndHeight()
        {
            var cube = new Cube(10, 10, 10);

            Assert.IsTrue(cube.Position() == new Vector3(5, 5, 5));
        }
        public void Interpolation_YandZRotation()
        {
            var cube = new Cube(13, 13, 13).Rotate(0, 270, -35);

            Assert.AreEqual(new Vector3(-1.59624145159665, 9.05273512416025, 6.5), cube.Position());
        }
        public void Interpolation_XAndYRotation()
        {
            var cube = new Cube(5, 5, 5).Rotate(120, 45, 0);

            Assert.AreEqual(new Vector3(2.41481456572267, -3.4150635094611, -1.12071934021007), cube.Position());
        }
        public void Interpolation_CenteredCubePositionNotUpdatedWhenRotated()
        {
            var cube = new Cube(5, 20, 20, true).Rotate(15, -120, 270);

            Assert.AreEqual(new Vector3(), cube.Position());
        }
        public void Interpolation_XandZRotation()
        {
            var cube = new Cube(13, 13, 13).Rotate(-145, 0, 190);

            Assert.AreEqual(new Vector3(-6.67843481376553, 0.443277802376793, -9.05273512416025), cube.Position());
        }
        public void Interpolation_PositionAfterLotsOfOperations()
        {
            var obj = new Cube(5, 10, 20).Mirror(0, 0, 1).Mirror(0, 1, 0)
                .Rotate(15, -45, 120).Translate(-20, 10, 15).Rotate(90, 15, 25)
                .Translate(-10, -20, -20).Rotate(-90, -90, -45);

            var position = obj.Position();
            Assert.AreEqual(new Vector3(-21.7567866493247, 28.2686425980997, -21.6189570529939), position);
        }
        public void Interpolation_XYZRotation()
        {
            var cube = new Cube(13, 13, 13).Rotate(90, 37.5, -180);

            Assert.AreEqual(new Vector3(-9.11374600044971, 6.5, 1.19984742333634), cube.Position());
        }