Esempio n. 1
0
    public void Dot()
    {
        for (int i = 0; i < count; i++)
        {
            Quaternion  a  = new Quaternion();
            Quaternion  b  = new Quaternion();
            Quaterniond ad = new Quaterniond();
            Quaterniond bd = new Quaterniond();

            RandomQuaternion(ref a, ref ad);
            RandomQuaternion(ref b, ref bd);

            float  value  = Quaternion.Dot(a, b);
            double valued = Quaterniond.Dot(ad, bd);

            Assert.True(Approximate(value, valued));
        }
    }
Esempio n. 2
0
    /// <summary>
    ///   <para>Returns the angle in degrees between two rotations a and b.</para>
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    public static double Angle(Quaterniond a, Quaterniond b)
    {
        double f = Quaterniond.Dot(a, b);

        return(Mathd.Acos(Mathd.Min(Mathd.Abs(f), 1f)) * 2f * 57.29578f);
    }
Esempio n. 3
0
 public static bool operator ==(Quaterniond lhs, Quaterniond rhs)
 {
     return(Quaterniond.Dot(lhs, rhs) > 0.999999f);
 }