CesiumLanguageWriterTests.TestMatrix3By3.TestMultiplyByMatrix C# (CSharp) Method

TestMultiplyByMatrix() private method

private TestMultiplyByMatrix ( ) : void
return void
        public void TestMultiplyByMatrix()
        {
            double angle = Math.PI / 4.0;
            double cos = Math.Cos(angle / 2.0);
            double sin = Math.Sin(angle / 2.0);

            double a = cos * cos - sin * sin / 3.0;
            double b = 2.0 * (sin * sin + sin * cos * Math.Sqrt(3.0)) / 3.0;
            double c = 2.0 * (sin * sin - sin * cos * Math.Sqrt(3.0)) / 3.0;

            // The matrix here is formed from the orthonormal set obtained by rotating
            // the x-axis, y-axis, and z-axis through an angle of 45 degrees about
            // the (1,1,1) vector.
            Matrix3By3 test = new Matrix3By3(a, c, b, b, a, c, c, b, a);
            Matrix3By3 transpose = test.Transpose();

            Matrix3By3 result = test.Multiply(transpose);
            Assert.IsTrue(result.EqualsEpsilon(Matrix3By3.Identity, 1e-16));

            result = test * transpose;
            Assert.IsTrue(result.EqualsEpsilon(Matrix3By3.Identity, 1e-16));
        }