Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implemented Matrix3(d) constructor that takes upper-left 3x3 of a Mat…

…rix4(d) as discussed in the following issue: #4
  • Loading branch information...
commit 94c7ad4f584c7cadff57514b22a46ac7419d4b15 1 parent 31ba0a3
@Robmaister Robmaister authored
Showing with 23 additions and 1 deletion.
  1. +11 −0 Source/OpenTK/Math/Matrix3.cs
  2. +12 −1 Source/OpenTK/Math/Matrix3d.cs
View
11 Source/OpenTK/Math/Matrix3.cs
@@ -99,6 +99,17 @@ public Matrix3(Vector3 row0, Vector3 row1, Vector3 row2)
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
13 Source/OpenTK/Math/Matrix3d.cs
@@ -94,7 +94,18 @@ public Matrix3d(Vector3d row0, Vector3d row1, Vector3d row2)
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
Please sign in to comment.
Something went wrong with that request. Please try again.