Beispiel #1
0
        public static double Angle(MVector3 from, MVector3 to)
        {
            // sqrt(a) * sqrt(b) = sqrt(a * b) -- valid for real numbers
            double denominator = Math.Sqrt(from.SqrMagnitude() * to.SqrMagnitude());

            if (denominator < kEpsilonNormalSqrt)
            {
                return(0F);
            }

            double dot = Clamp(Dot(from, to) / denominator, -1F, 1F);

            return((Math.Acos(dot)) * Rad2Deg);
        }