示例#1
0
        /// <summary>
        /// Returns the minimum angle between two vectors.
        /// </summary>
        /// <param name="v0"></param>
        /// <param name="v1"></param>
        /// <returns></returns>
        public static float Angle(Vector3f v0, Vector3f v1)
        {
            var d = v0.SquareLength * v1.SquareLength;

            return(d > 0.0f ? SlurMath.AcosSafe(Dot(v0, v1) / SlurMath.Sqrt(d)) : 0.0f);
        }
示例#2
0
        /// <summary>
        /// Returns the angle between two vectors.
        /// </summary>
        /// <param name="v0"></param>
        /// <param name="v1"></param>
        /// <returns></returns>
        public static double Angle(Vector2d v0, Vector2d v1)
        {
            var d = v0.SquareLength * v1.SquareLength;

            return(d > 0.0 ? SlurMath.AcosSafe(Dot(v0, v1) / Math.Sqrt(d)) : 0.0);
        }