A couple more maths functions
This commit is contained in:
parent
11114ca4ea
commit
b20b21d228
2 changed files with 25 additions and 2 deletions
|
@ -280,6 +280,17 @@ namespace OpenTK
|
|||
Row2.Xyz = Row2.Xyz.Normalized();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an inverted copy of this instance.
|
||||
/// </summary>
|
||||
public Matrix4 Inverted()
|
||||
{
|
||||
Matrix4 m = this;
|
||||
if (m.Determinant != 0)
|
||||
m.Invert();
|
||||
return m;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the translation component of this instance.
|
||||
/// </summary>
|
||||
|
@ -343,7 +354,8 @@ namespace OpenTK
|
|||
q.Y = (float)((Row2[1] + Row1[2]) * sq);
|
||||
}
|
||||
|
||||
return q.Normalized();
|
||||
q.Normalize();
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,6 @@ namespace OpenTK
|
|||
/// <summary>
|
||||
/// Returns a copy of the Quaternion scaled to unit length.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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()
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue