diff --git a/Source/OpenTK/Math/Matrix4.cs b/Source/OpenTK/Math/Matrix4.cs index 48cc7fd5..1cec3d49 100644 --- a/Source/OpenTK/Math/Matrix4.cs +++ b/Source/OpenTK/Math/Matrix4.cs @@ -249,6 +249,9 @@ namespace OpenTK #region public void Invert() + /// + /// Converts this instance into its inverse. + /// public void Invert() { this = Matrix4.Invert(this); @@ -259,7 +262,7 @@ namespace OpenTK #region public void Transpose() /// - /// Calculates the transpose of this instance. + /// Converts this instance into its transpose. /// public void Transpose() { @@ -836,7 +839,7 @@ namespace OpenTK Vector3 axis; float angle; q.ToAxisAngle(out axis, out angle); - return Rotate(axis, angle); + return CreateFromAxisAngle(axis, angle); } #endregion @@ -1128,11 +1131,23 @@ namespace OpenTK return Matrix4.Mult(left, right); } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Matrix4 left, Matrix4 right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equal right; false otherwise. public static bool operator !=(Matrix4 left, Matrix4 right) { return !left.Equals(right); diff --git a/Source/OpenTK/Math/Matrix4d.cs b/Source/OpenTK/Math/Matrix4d.cs index 14562663..b54af027 100644 --- a/Source/OpenTK/Math/Matrix4d.cs +++ b/Source/OpenTK/Math/Matrix4d.cs @@ -249,6 +249,9 @@ namespace OpenTK #region public void Invert() + /// + /// Converts this instance into its inverse. + /// public void Invert() { this = Matrix4d.Invert(this); @@ -258,6 +261,9 @@ namespace OpenTK #region public void Transpose() + /// + /// Converts this instance into its transpose. + /// public void Transpose() { this = Matrix4d.Transpose(this); @@ -981,11 +987,23 @@ namespace OpenTK return Matrix4d.Mult(left, right); } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Matrix4d left, Matrix4d right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equal right; false otherwise. public static bool operator !=(Matrix4d left, Matrix4d right) { return !left.Equals(right); diff --git a/Source/OpenTK/Math/Quaternion.cs b/Source/OpenTK/Math/Quaternion.cs index 3fdc5383..0f96a78e 100644 --- a/Source/OpenTK/Math/Quaternion.cs +++ b/Source/OpenTK/Math/Quaternion.cs @@ -278,7 +278,7 @@ namespace OpenTK /// /// The left instance. /// The right instance. - /// The result of the operation. + /// The result of the operation. public static void Sub(ref Quaternion left, ref Quaternion right, out Quaternion result) { result = new Quaternion( @@ -290,6 +290,12 @@ namespace OpenTK #region Mult + /// + /// Multiplies two instances. + /// + /// The first instance. + /// The second instance. + /// A new instance containing the result of the calculation. public static Quaternion Mult(Quaternion left, Quaternion right) { return new Quaternion( @@ -297,6 +303,12 @@ namespace OpenTK left.W * right.W - Vector3.Dot(left.Xyz, right.Xyz)); } + /// + /// Multiplies two instances. + /// + /// The first instance. + /// The second instance. + /// A new instance containing the result of the calculation. public static void Mult(ref Quaternion left, ref Quaternion right, out Quaternion result) { result = new Quaternion( @@ -488,6 +500,12 @@ namespace OpenTK #region Operators + /// + /// Adds two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Quaternion operator +(Quaternion left, Quaternion right) { left.Xyz += right.Xyz; @@ -495,6 +513,12 @@ namespace OpenTK return left; } + /// + /// Subtracts two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Quaternion operator -(Quaternion left, Quaternion right) { left.Xyz -= right.Xyz; @@ -502,6 +526,12 @@ namespace OpenTK return left; } + /// + /// Multiplies two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Quaternion operator *(Quaternion left, Quaternion right) { float w = left.W * right.W - Vector3.Dot(left.Xyz, right.Xyz); @@ -510,11 +540,23 @@ namespace OpenTK return left; } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Quaternion left, Quaternion right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equal right; false otherwise. public static bool operator !=(Quaternion left, Quaternion right) { return !left.Equals(right); diff --git a/Source/OpenTK/Math/Quaterniond.cs b/Source/OpenTK/Math/Quaterniond.cs index 1c4bdb52..35a68aff 100644 --- a/Source/OpenTK/Math/Quaterniond.cs +++ b/Source/OpenTK/Math/Quaterniond.cs @@ -278,7 +278,7 @@ namespace OpenTK /// /// The left instance. /// The right instance. - /// The result of the operation. + /// The result of the operation. public static void Sub(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result = new Quaterniond( @@ -290,6 +290,12 @@ namespace OpenTK #region Mult + /// + /// Multiplies two instances. + /// + /// The first instance. + /// The second instance. + /// A new instance containing the result of the calculation. public static Quaterniond Mult(Quaterniond left, Quaterniond right) { return new Quaterniond( @@ -297,6 +303,12 @@ namespace OpenTK left.W * right.W - Vector3d.Dot(left.Xyz, right.Xyz)); } + /// + /// Multiplies two instances. + /// + /// The first instance. + /// The second instance. + /// A new instance containing the result of the calculation. public static void Mult(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result = new Quaterniond( @@ -488,6 +500,12 @@ namespace OpenTK #region Operators + /// + /// Adds two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Quaterniond operator +(Quaterniond left, Quaterniond right) { left.Xyz += right.Xyz; @@ -495,6 +513,12 @@ namespace OpenTK return left; } + /// + /// Subtracts two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Quaterniond operator -(Quaterniond left, Quaterniond right) { left.Xyz -= right.Xyz; @@ -502,6 +526,12 @@ namespace OpenTK return left; } + /// + /// Multiplies two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Quaterniond operator *(Quaterniond left, Quaterniond right) { double w = left.W * right.W - Vector3d.Dot(left.Xyz, right.Xyz); @@ -510,11 +540,23 @@ namespace OpenTK return left; } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Quaterniond left, Quaterniond right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equal right; false otherwise. public static bool operator !=(Quaterniond left, Quaterniond right) { return !left.Equals(right); diff --git a/Source/OpenTK/Math/Vector3.cs b/Source/OpenTK/Math/Vector3.cs index 214ae445..819fa2de 100644 --- a/Source/OpenTK/Math/Vector3.cs +++ b/Source/OpenTK/Math/Vector3.cs @@ -1022,6 +1022,12 @@ namespace OpenTK #region Operators + /// + /// Adds two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector3 operator +(Vector3 left, Vector3 right) { left.X += right.X; @@ -1030,6 +1036,12 @@ namespace OpenTK return left; } + /// + /// Subtracts two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector3 operator -(Vector3 left, Vector3 right) { left.X -= right.X; @@ -1038,6 +1050,11 @@ namespace OpenTK return left; } + /// + /// Negates an instance. + /// + /// The instance. + /// The result of the calculation. public static Vector3 operator -(Vector3 vec) { vec.X = -vec.X; @@ -1046,36 +1063,66 @@ namespace OpenTK return vec; } - public static Vector3 operator *(Vector3 vec, float f) + /// + /// Multiplies an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector3 operator *(Vector3 vec, float scale) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; return vec; } - public static Vector3 operator *(float f, Vector3 vec) + /// + /// Multiplies an instance by a scalar. + /// + /// The scalar. + /// The instance. + /// The result of the calculation. + public static Vector3 operator *(float scale, Vector3 vec) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; return vec; } - public static Vector3 operator /(Vector3 vec, float f) + /// + /// Divides an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector3 operator /(Vector3 vec, float scale) { - float mult = 1.0f / f; + float mult = 1.0f / scale; vec.X *= mult; vec.Y *= mult; vec.Z *= mult; return vec; } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Vector3 left, Vector3 right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equa lright; false otherwise. public static bool operator !=(Vector3 left, Vector3 right) { return !left.Equals(right); diff --git a/Source/OpenTK/Math/Vector3d.cs b/Source/OpenTK/Math/Vector3d.cs index e120b8de..66e33b82 100644 --- a/Source/OpenTK/Math/Vector3d.cs +++ b/Source/OpenTK/Math/Vector3d.cs @@ -1019,6 +1019,12 @@ namespace OpenTK #region Operators + /// + /// Adds two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector3d operator +(Vector3d left, Vector3d right) { left.X += right.X; @@ -1027,6 +1033,12 @@ namespace OpenTK return left; } + /// + /// Subtracts two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector3d operator -(Vector3d left, Vector3d right) { left.X -= right.X; @@ -1035,6 +1047,11 @@ namespace OpenTK return left; } + /// + /// Negates an instance. + /// + /// The instance. + /// The result of the calculation. public static Vector3d operator -(Vector3d vec) { vec.X = -vec.X; @@ -1043,36 +1060,66 @@ namespace OpenTK return vec; } - public static Vector3d operator *(Vector3d vec, double f) + /// + /// Multiplies an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector3d operator *(Vector3d vec, double scale) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; return vec; } - public static Vector3d operator *(double f, Vector3d vec) + /// + /// Multiplies an instance by a scalar. + /// + /// The scalar. + /// The instance. + /// The result of the calculation. + public static Vector3d operator *(double scale, Vector3d vec) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; return vec; } - public static Vector3d operator /(Vector3d vec, double f) + /// + /// Divides an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector3d operator /(Vector3d vec, double scale) { - double mult = 1.0f / f; + double mult = 1 / scale; vec.X *= mult; vec.Y *= mult; vec.Z *= mult; return vec; } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Vector3d left, Vector3d right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equa lright; false otherwise. public static bool operator !=(Vector3d left, Vector3d right) { return !left.Equals(right); diff --git a/Source/OpenTK/Math/Vector4.cs b/Source/OpenTK/Math/Vector4.cs index 677c9b2e..43552c13 100644 --- a/Source/OpenTK/Math/Vector4.cs +++ b/Source/OpenTK/Math/Vector4.cs @@ -847,6 +847,12 @@ namespace OpenTK #region Operators + /// + /// Adds two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector4 operator +(Vector4 left, Vector4 right) { left.X += right.X; @@ -856,6 +862,12 @@ namespace OpenTK return left; } + /// + /// Subtracts two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector4 operator -(Vector4 left, Vector4 right) { left.X -= right.X; @@ -865,6 +877,11 @@ namespace OpenTK return left; } + /// + /// Negates an instance. + /// + /// The instance. + /// The result of the calculation. public static Vector4 operator -(Vector4 vec) { vec.X = -vec.X; @@ -874,27 +891,45 @@ namespace OpenTK return vec; } - public static Vector4 operator *(Vector4 vec, float f) + /// + /// Multiplies an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector4 operator *(Vector4 vec, float scale) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; - vec.W *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; + vec.W *= scale; return vec; } - public static Vector4 operator *(float f, Vector4 vec) + /// + /// Multiplies an instance by a scalar. + /// + /// The scalar. + /// The instance. + /// The result of the calculation. + public static Vector4 operator *(float scale, Vector4 vec) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; - vec.W *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; + vec.W *= scale; return vec; } - public static Vector4 operator /(Vector4 vec, float f) + /// + /// Divides an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector4 operator /(Vector4 vec, float scale) { - float mult = 1.0f / f; + float mult = 1.0f / scale; vec.X *= mult; vec.Y *= mult; vec.Z *= mult; @@ -902,22 +937,44 @@ namespace OpenTK return vec; } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Vector4 left, Vector4 right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equa lright; false otherwise. public static bool operator !=(Vector4 left, Vector4 right) { return !left.Equals(right); } + /// + /// Returns a pointer to the first element of the specified instance. + /// + /// The instance. + /// A pointer to the first element of v. [CLSCompliant(false)] unsafe public static explicit operator float*(Vector4 v) { return &v.X; } + /// + /// Returns a pointer to the first element of the specified instance. + /// + /// The instance. + /// A pointer to the first element of v. public static explicit operator IntPtr(Vector4 v) { unsafe diff --git a/Source/OpenTK/Math/Vector4d.cs b/Source/OpenTK/Math/Vector4d.cs index c121f790..9edea219 100644 --- a/Source/OpenTK/Math/Vector4d.cs +++ b/Source/OpenTK/Math/Vector4d.cs @@ -844,6 +844,12 @@ namespace OpenTK #region Operators + /// + /// Adds two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector4d operator +(Vector4d left, Vector4d right) { left.X += right.X; @@ -853,6 +859,12 @@ namespace OpenTK return left; } + /// + /// Subtracts two instances. + /// + /// The first instance. + /// The second instance. + /// The result of the calculation. public static Vector4d operator -(Vector4d left, Vector4d right) { left.X -= right.X; @@ -862,6 +874,11 @@ namespace OpenTK return left; } + /// + /// Negates an instance. + /// + /// The instance. + /// The result of the calculation. public static Vector4d operator -(Vector4d vec) { vec.X = -vec.X; @@ -871,27 +888,45 @@ namespace OpenTK return vec; } - public static Vector4d operator *(Vector4d vec, double f) + /// + /// Multiplies an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector4d operator *(Vector4d vec, double scale) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; - vec.W *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; + vec.W *= scale; return vec; } - public static Vector4d operator *(double f, Vector4d vec) + /// + /// Multiplies an instance by a scalar. + /// + /// The scalar. + /// The instance. + /// The result of the calculation. + public static Vector4d operator *(double scale, Vector4d vec) { - vec.X *= f; - vec.Y *= f; - vec.Z *= f; - vec.W *= f; + vec.X *= scale; + vec.Y *= scale; + vec.Z *= scale; + vec.W *= scale; return vec; } - public static Vector4d operator /(Vector4d vec, double f) + /// + /// Divides an instance by a scalar. + /// + /// The instance. + /// The scalar. + /// The result of the calculation. + public static Vector4d operator /(Vector4d vec, double scale) { - double mult = 1.0f / f; + double mult = 1 / scale; vec.X *= mult; vec.Y *= mult; vec.Z *= mult; @@ -899,22 +934,44 @@ namespace OpenTK return vec; } + /// + /// Compares two instances for equality. + /// + /// The first instance. + /// The second instance. + /// True, if left equals right; false otherwise. public static bool operator ==(Vector4d left, Vector4d right) { return left.Equals(right); } + /// + /// Compares two instances for inequality. + /// + /// The first instance. + /// The second instance. + /// True, if left does not equa lright; false otherwise. public static bool operator !=(Vector4d left, Vector4d right) { return !left.Equals(right); } + /// + /// Returns a pointer to the first element of the specified instance. + /// + /// The instance. + /// A pointer to the first element of v. [CLSCompliant(false)] unsafe public static explicit operator double*(Vector4d v) { return &v.X; } + /// + /// Returns a pointer to the first element of the specified instance. + /// + /// The instance. + /// A pointer to the first element of v. public static explicit operator IntPtr(Vector4d v) { unsafe