diff --git a/Source/OpenTK/Math/Vector2.cs b/Source/OpenTK/Math/Vector2.cs index 3d57024a..b94d7b5c 100644 --- a/Source/OpenTK/Math/Vector2.cs +++ b/Source/OpenTK/Math/Vector2.cs @@ -147,12 +147,12 @@ namespace OpenTK.Math #endregion - #region public Vector2 Perpendicular + #region public Vector2 PerpendicularRight /// - /// Gets the perpendicular vector. + /// Gets the perpendicular vector on the right side of this vector. /// - public Vector2 Perpendicular + public Vector2 PerpendicularRight { get { @@ -160,7 +160,22 @@ namespace OpenTK.Math } } - #endregion + #endregion + + #region public Vector2 PerpendicularLeft + + /// + /// Gets the perpendicular vector on the left side of this vector. + /// + public Vector2 PerpendicularLeft + { + get + { + return new Vector2(-Y, X); + } + } + + #endregion #region public void Normalize() diff --git a/Source/OpenTK/Math/Vector3.cs b/Source/OpenTK/Math/Vector3.cs index 7747eff2..9e4ca82a 100644 --- a/Source/OpenTK/Math/Vector3.cs +++ b/Source/OpenTK/Math/Vector3.cs @@ -157,7 +157,7 @@ namespace OpenTK.Math #endregion - #region public Vector3 Normalize() + #region public void Normalize() /// /// Scales the Vector3 to unit length. @@ -172,7 +172,7 @@ namespace OpenTK.Math #endregion - #region public Vector3 NormalizeFast() + #region public void NormalizeFast() /// /// Scales the Vector3 to approximately unit length. @@ -187,7 +187,7 @@ namespace OpenTK.Math #endregion - #region public Vector3 Scale(float sx, float sy, float sz) + #region public void Scale(float sx, float sy, float sz) /// /// Scales the current Vector3 by the given amounts. @@ -780,6 +780,22 @@ namespace OpenTK.Math #endregion + #region CalculateAngle + + /// + /// Calculates the angle (in radians) between two vectors. + /// + /// The first vector. + /// The second vector. + /// Angle (in radians) between the vectors. + /// Note that the returned angle is never bigger than the constant Pi. + public static float CalculateAngle(Vector3 first, Vector3 second) + { + return (float)System.Math.Acos((Vector3.Dot(first, second)) / (first.Length * second.Length)); + } + + #endregion + #endregion #region public override string ToString()