diff --git a/Source/OpenTK/Math/Matrix4.cs b/Source/OpenTK/Math/Matrix4.cs
index 0e221fe4..39033a20 100644
--- a/Source/OpenTK/Math/Matrix4.cs
+++ b/Source/OpenTK/Math/Matrix4.cs
@@ -280,6 +280,17 @@ namespace OpenTK
Row2.Xyz = Row2.Xyz.Normalized();
}
+ ///
+ /// Returns an inverted copy of this instance.
+ ///
+ public Matrix4 Inverted()
+ {
+ Matrix4 m = this;
+ if (m.Determinant != 0)
+ m.Invert();
+ return m;
+ }
+
///
/// Gets the translation component of this instance.
///
@@ -343,7 +354,8 @@ namespace OpenTK
q.Y = (float)((Row2[1] + Row1[2]) * sq);
}
- return q.Normalized();
+ q.Normalize();
+ return q;
}
}
diff --git a/Source/OpenTK/Math/Quaternion.cs b/Source/OpenTK/Math/Quaternion.cs
index 33050e6f..fa08a01d 100644
--- a/Source/OpenTK/Math/Quaternion.cs
+++ b/Source/OpenTK/Math/Quaternion.cs
@@ -192,7 +192,6 @@ namespace OpenTK
///
/// Returns a copy of the Quaternion scaled to unit length.
///
- ///
public Quaternion Normalized()
{
Quaternion q = this;
@@ -200,6 +199,18 @@ namespace OpenTK
return q;
}
+ public void Invert()
+ {
+ W = -W;
+ }
+
+ public Quaternion Inverted()
+ {
+ var q = this;
+ q.Invert();
+ return q;
+ }
+
#region public void Normalize()
///