mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-02 10:20:59 +00:00
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:
parent
46f25f27a4
commit
5a3cd34953
|
@ -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.
Loading…
Reference in a new issue