Removed cast to float from Vector3d.CalculateAngle (unnecessary precision loss as double is returned).

Overloaded static Vector3 and Vector3d CalculateAngle methods.
This commit is contained in:
chrisbrandtner 2009-01-24 16:15:04 +00:00
parent 46f25f27a4
commit 5a3cd34953
2 changed files with 12 additions and 0 deletions

View file

@ -896,6 +896,18 @@ namespace OpenTK.Math
return (float)System.Math.Acos((Vector3.Dot(first, second)) / (first.Length * second.Length));
}
/// <summary>Calculates the angle (in radians) between two vectors.</summary>
/// <param name="first">The first vector.</param>
/// <param name="second">The second vector.</param>
/// <param name="result">Angle (in radians) between the vectors.</param>
/// <remarks>Note that the returned angle is never bigger than the constant Pi.</remarks>
public static void CalculateAngle( ref Vector3 first, ref Vector3 second, out float result )
{
float temp;
Vector3.Dot( ref first, ref second, out temp );
result = (float)System.Math.Acos( temp / ( first.Length * second.Length ) );
}
#endregion
#endregion

Binary file not shown.