diff --git a/Source/OpenTK/Math/Vector2.cs b/Source/OpenTK/Math/Vector2.cs
index 2cc8776a..e4a98ae7 100644
--- a/Source/OpenTK/Math/Vector2.cs
+++ b/Source/OpenTK/Math/Vector2.cs
@@ -27,9 +27,7 @@ using System.Runtime.InteropServices;
namespace OpenTK.Math
{
- ///
- /// Represents a 2D vector.
- ///
+ /// Represents a 2D vector using two single-precision floating-point numbers.
///
/// The Vector2 structure is suitable for interoperation with unmanaged code requiring two consecutive floats.
///
@@ -562,7 +560,7 @@ namespace OpenTK.Math
#region Dot
///
- /// Caclulate the dot (scalar) product of two vectors
+ /// Calculate the dot (scalar) product of two vectors
///
/// First operand
/// Second operand
@@ -572,6 +570,17 @@ namespace OpenTK.Math
return left.X * right.X + left.Y * right.Y;
}
+ ///
+ /// Calculate the dot (scalar) product of two vectors
+ ///
+ /// First operand
+ /// Second operand
+ /// The dot product of the two inputs
+ public static void Dot( ref Vector2 left, ref Vector2 right, out float result )
+ {
+ result = left.X * right.X + left.Y * right.Y;
+ }
+
#endregion
#region Lerp
@@ -581,7 +590,7 @@ namespace OpenTK.Math
///
/// First input vector
/// Second input vector
- /// The blend factor
+ /// The blend factor. a when blend=0, b when blend=1.
/// a when blend=0, b when blend=1, and a linear combination otherwise
public static Vector2 Lerp(Vector2 a, Vector2 b, float blend)
{
@@ -590,6 +599,19 @@ namespace OpenTK.Math
return a;
}
+ ///
+ /// Returns a new Vector that is the linear blend of the 2 given Vectors
+ ///
+ /// First input vector
+ /// Second input vector
+ /// The blend factor. a when blend=0, b when blend=1.
+ /// a when blend=0, b when blend=1, and a linear combination otherwise
+ public static void Lerp( ref Vector2 a, ref Vector2 b, float blend, out Vector2 result )
+ {
+ result.X = blend * ( b.X - a.X ) + a.X;
+ result.Y = blend * ( b.Y - a.Y ) + a.Y;
+ }
+
#endregion
#region Barycentric
diff --git a/Source/OpenTK/Math/Vector2d.cs b/Source/OpenTK/Math/Vector2d.cs
index bf9f9a54..1b1ac53c 100644
Binary files a/Source/OpenTK/Math/Vector2d.cs and b/Source/OpenTK/Math/Vector2d.cs differ
diff --git a/Source/OpenTK/Math/Vector3.cs b/Source/OpenTK/Math/Vector3.cs
index 6d033582..c6ed429a 100644
--- a/Source/OpenTK/Math/Vector3.cs
+++ b/Source/OpenTK/Math/Vector3.cs
@@ -27,9 +27,10 @@ using System.Runtime.InteropServices;
namespace OpenTK.Math
{
- ///
- /// Represents a three-dimensional vector.
- ///
+ /// Represents a 3D vector using three single-precision floating-point numbers.
+ ///
+ /// The Vector3 structure is suitable for interoperation with unmanaged code requiring three consecutive floats.
+ ///
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct Vector3 : IEquatable
@@ -563,7 +564,7 @@ namespace OpenTK.Math
#region Dot
///
- /// Caclulate the dot (scalar) product of two vectors
+ /// Calculate the dot (scalar) product of two vectors
///
/// First operand
/// Second operand
@@ -573,6 +574,17 @@ namespace OpenTK.Math
return left.X * right.X + left.Y * right.Y + left.Z * right.Z;
}
+ ///
+ /// Calculate the dot (scalar) product of two vectors
+ ///
+ /// First operand
+ /// Second operand
+ /// The dot product of the two inputs
+ public static void Dot( ref Vector3 left, ref Vector3 right, out float result )
+ {
+ result = left.X * right.X + left.Y * right.Y + left.Z * right.Z;
+ }
+
#endregion
#region Cross
@@ -585,14 +597,9 @@ namespace OpenTK.Math
/// The cross product of the two inputs
public static Vector3 Cross(Vector3 left, Vector3 right)
{
- float
- x = left.Y * right.Z - left.Z * right.Y,
- y = left.Z * right.X - left.X * right.Z,
- z = left.X * right.Y - left.Y * right.X;
- left.X = x;
- left.Y = y;
- left.Z = z;
- return left;
+ return new Vector3(left.Y * right.Z - left.Z * right.Y,
+ left.Z * right.X - left.X * right.Z,
+ left.X * right.Y - left.Y * right.X);
}
///
@@ -618,7 +625,7 @@ namespace OpenTK.Math
///
/// First input vector
/// Second input vector
- /// The blend factor
+ /// The blend factor. a when blend=0, b when blend=1.
/// a when blend=0, b when blend=1, and a linear combination otherwise
public static Vector3 Lerp(Vector3 a, Vector3 b, float blend)
{
@@ -628,6 +635,20 @@ namespace OpenTK.Math
return a;
}
+ ///
+ /// Returns a new Vector that is the linear blend of the 2 given Vectors
+ ///
+ /// First input vector
+ /// Second input vector
+ /// The blend factor. a when blend=0, b when blend=1.
+ /// a when blend=0, b when blend=1, and a linear combination otherwise
+ public static void Lerp( ref Vector3 a, ref Vector3 b, float blend, out Vector3 result )
+ {
+ result.X = blend * ( b.X - a.X ) + a.X;
+ result.Y = blend * ( b.Y - a.Y ) + a.Y;
+ result.Z = blend * ( b.Z - a.Z ) + a.Z;
+ }
+
#endregion
#region Barycentric
diff --git a/Source/OpenTK/Math/Vector3d.cs b/Source/OpenTK/Math/Vector3d.cs
index 95586396..86beac17 100644
Binary files a/Source/OpenTK/Math/Vector3d.cs and b/Source/OpenTK/Math/Vector3d.cs differ
diff --git a/Source/OpenTK/Math/Vector4.cs b/Source/OpenTK/Math/Vector4.cs
index 18d68d75..cd52aa0b 100644
--- a/Source/OpenTK/Math/Vector4.cs
+++ b/Source/OpenTK/Math/Vector4.cs
@@ -27,9 +27,10 @@ using System.Runtime.InteropServices;
namespace OpenTK.Math
{
- ///
- /// Represents a four-dimensional vector.
- ///
+ /// Represents a 4D vector using four single-precision floating-point numbers.
+ ///
+ /// The Vector4 structure is suitable for interoperation with unmanaged code requiring four consecutive floats.
+ ///
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct Vector4 : IEquatable
@@ -566,7 +567,7 @@ namespace OpenTK.Math
#region Dot
///
- /// Caclulate the dot product of two vectors
+ /// Calculate the dot product of two vectors
///
/// First operand
/// Second operand
@@ -576,6 +577,19 @@ namespace OpenTK.Math
return left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
}
+ ///
+ /// Calculate the dot product of two vectors
+ ///
+ /// First operand
+ /// Second operand
+ /// The dot product of the two inputs
+ public static void Dot( ref Vector4 left, ref Vector4 right, out float result )
+ {
+ result = left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
+ }
+
+
+
#endregion
#region Lerp
@@ -585,7 +599,7 @@ namespace OpenTK.Math
///
/// First input vector
/// Second input vector
- /// The blend factor
+ /// The blend factor. a when blend=0, b when blend=1.
/// a when blend=0, b when blend=1, and a linear combination otherwise
public static Vector4 Lerp(Vector4 a, Vector4 b, float blend)
{
@@ -596,6 +610,21 @@ namespace OpenTK.Math
return a;
}
+ ///
+ /// Returns a new Vector that is the linear blend of the 2 given Vectors
+ ///
+ /// First input vector
+ /// Second input vector
+ /// The blend factor. a when blend=0, b when blend=1.
+ /// a when blend=0, b when blend=1, and a linear combination otherwise
+ public static void Lerp( ref Vector4 a, ref Vector4 b, float blend, out Vector4 result )
+ {
+ result.X = blend * ( b.X - a.X ) + a.X;
+ result.Y = blend * ( b.Y - a.Y ) + a.Y;
+ result.Z = blend * ( b.Z - a.Z ) + a.Z;
+ result.W = blend * ( b.W - a.W ) + a.W;
+ }
+
#endregion
#region Barycentric
diff --git a/Source/OpenTK/Math/Vector4d.cs b/Source/OpenTK/Math/Vector4d.cs
index 8a09c2c3..b0a9eb75 100644
--- a/Source/OpenTK/Math/Vector4d.cs
+++ b/Source/OpenTK/Math/Vector4d.cs
@@ -27,12 +27,12 @@ using System.Runtime.InteropServices;
namespace OpenTK.Math
{
- /// A 4-dimensional vector using double-precision floating point numbers.
+ /// Represents a 4D vector using four double-precision floating-point numbers.
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct Vector4d : IEquatable
{
- #region Fields
+ #region Fields
///
/// The X component of the Vector4d.
@@ -564,7 +564,7 @@ namespace OpenTK.Math
#region Dot
///
- /// Caclulate the dot product of two vectors
+ /// Calculate the dot product of two vectors
///
/// First operand
/// Second operand
@@ -574,6 +574,17 @@ namespace OpenTK.Math
return left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
}
+ ///
+ /// Calculate the dot product of two vectors
+ ///
+ /// First operand
+ /// Second operand
+ /// The dot product of the two inputs
+ public static void Dot( ref Vector4d left, ref Vector4d right, out double result )
+ {
+ result = left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
+ }
+
#endregion
#region Lerp
@@ -583,7 +594,7 @@ namespace OpenTK.Math
///
/// First input vector
/// Second input vector
- /// The blend factor
+ /// The blend factor. a when blend=0, b when blend=1.
/// a when blend=0, b when blend=1, and a linear combination otherwise
public static Vector4d Lerp(Vector4d a, Vector4d b, double blend)
{
@@ -594,6 +605,21 @@ namespace OpenTK.Math
return a;
}
+ ///
+ /// Returns a new Vector that is the linear blend of the 2 given Vectors
+ ///
+ /// First input vector
+ /// Second input vector
+ /// The blend factor. a when blend=0, b when blend=1.
+ /// a when blend=0, b when blend=1, and a linear combination otherwise
+ public static void Lerp( ref Vector4d a, ref Vector4d b, double blend, out Vector4d result )
+ {
+ result.X = blend * ( b.X - a.X ) + a.X;
+ result.Y = blend * ( b.Y - a.Y ) + a.Y;
+ result.Z = blend * ( b.Z - a.Z ) + a.Z;
+ result.W = blend * ( b.W - a.W ) + a.W;
+ }
+
#endregion
#region Barycentric