public void DivisionScalar() { float s = 123.456f; QuaternionF q = new QuaternionF(1.0f, 2.0f, 3.0f, 4.0f); QuaternionF expectedResult = new QuaternionF(1.0f / s, 2.0f / s, 3.0f / s, 4.0f / s); QuaternionF result = QuaternionF.Divide(q, s); Assert.IsTrue(QuaternionF.AreNumericallyEqual(expectedResult, result)); }
public void Division() { float angle1 = 0.4f; Vector3F axis1 = new Vector3F(1.0f, 2.0f, 3.0f); QuaternionF q1 = QuaternionF.CreateRotation(axis1, angle1); Matrix33F m1 = Matrix33F.CreateRotation(axis1, angle1); float angle2 = -1.6f; Vector3F axis2 = new Vector3F(1.0f, -2.0f, -3.5f); QuaternionF q2 = QuaternionF.CreateRotation(axis2, angle2); Matrix33F m2 = Matrix33F.CreateRotation(axis2, angle2); Vector3F v = new Vector3F(0.3f, -2.4f, 5.6f); Vector3F result1 = QuaternionF.Divide(q2, q1).Rotate(v); Vector3F result2 = m2 * m1.Inverse * v; Assert.IsTrue(Vector3F.AreNumericallyEqual(result1, result2)); }