Example #1
0
        public void CreatePlaneCoordinateSystemTest_WhenCoordinateSystemIsCalledWithOffsetAndNormal_ThenTranslationIsOffsetAndEzIsNormal()
        {
            var normal = new Vector3D(1.0, 1.0, 1.0).Normalize();
            var offset = new Position3D(2, 3, 4);

            var mat = Matrix44D.CreatePlaneCoordinateSystem(offset, normal);

            Assert.Equal(offset, mat.Offset);
            Assert.Equal(offset.ToVector3D(), mat.Translation);
            Assert.Equal(normal, mat.Ez);
            Assert.Equal(0.0, mat.Ex * mat.Ey, ConstantsMath.Precision);
            Assert.Equal(0.0, mat.Ey * mat.Ez, ConstantsMath.Precision);
            Assert.Equal(0.0, mat.Ez * mat.Ex, ConstantsMath.Precision);
        }
Example #2
0
        public void CreatePlaneCoordinateSystemTest_WhenCoordinateSystemIsCalledWithOffsetAndTwoPlaneVectors_ThenTranslationIsOffsetAndEzIsNormal()
        {
            var first  = new Vector3D(1.0, 1.0, 0.0).Normalize();
            var second = new Vector3D(1.0, -1.0, 0.0).Normalize();
            var offset = new Position3D(2, 3, 4);

            var mat = Matrix44D.CreatePlaneCoordinateSystem(offset, first, second);

            var expectedNormal = (first & second).Normalize();

            Assert.Equal(offset, mat.Offset);
            Assert.Equal(offset.ToVector3D(), mat.Translation);
            Assert.Equal(expectedNormal, mat.Ez);
            Assert.Equal(0.0, mat.Ex * mat.Ey, ConstantsMath.Precision);
            Assert.Equal(0.0, mat.Ey * mat.Ez, ConstantsMath.Precision);
            Assert.Equal(0.0, mat.Ez * mat.Ex, ConstantsMath.Precision);
        }