Implemented Matrix3(d) constructor that takes upper-left 3x3 of a Matrix4(d) as discussed in the following issue: https://github.com/andykorth/opentk/issues/4

This commit is contained in:
Robert Rouhani 2013-01-26 12:57:19 -05:00
parent 31ba0a36b9
commit 94c7ad4f58
2 changed files with 23 additions and 1 deletions

View file

@ -99,6 +99,17 @@ namespace OpenTK
Row1 = new Vector3(m10, m11, m12);
Row2 = new Vector3(m20, m21, m22);
}
/// <summary>
/// Constructs a new instnace.
/// </summary>
/// <param name="matrix">A Matrix4 to take the upper-left 3x3 from.</param>
public Matrix3(Matrix4 matrix)
{
Row0 = matrix.Row0.Xyz;
Row1 = matrix.Row1.Xyz;
Row2 = matrix.Row2.Xyz;
}
#endregion

View file

@ -94,7 +94,18 @@ namespace OpenTK
Row1 = new Vector3d(m10, m11, m12);
Row2 = new Vector3d(m20, m21, m22);
}
/// <summary>
/// Constructs a new instance.
/// </summary>
/// <param name="matrix">A Matrix4d to take the upper-left 3x3 from.</param>
public Matrix3d(Matrix4d matrix)
{
Row0 = matrix.Row0.Xyz;
Row1 = matrix.Row1.Xyz;
Row2 = matrix.Row2.Xyz;
}
#endregion
#region Public Members