public float M33 { get { return Row2.Z; } set { Row2.Z = value; } }
#endregion
-
+
+ #region Indexers
+
+ /// <summary>
+ /// Gets or sets the value at a specified row and column.
+ /// </summary>
+ public float this[int rowIndex, int columnIndex]
+ {
+ get
+ {
+ if (rowIndex == 0) return Row0[columnIndex];
+ else if (rowIndex == 1) return Row1[columnIndex];
+ else if (rowIndex == 2) return Row2[columnIndex];
+ throw new IndexOutOfRangeException("You tried to access this matrix at: (" + rowIndex + ", " + columnIndex + ")");
+ }
+ set
+ {
+ if (rowIndex == 0) Row0[columnIndex] = value;
+ else if (rowIndex == 1) Row1[columnIndex] = value;
+ else if (rowIndex == 2) Row2[columnIndex] = value;
+ throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")");
+ }
+ }
+
+ #endregion
+
#region Instance
-
+
#region public void Invert()
+ /// <summary>
+ /// Converts this instance into its inverse.
+ /// </summary>
public void Invert()
{
this = Matrix3.Invert(this);
{
return new Matrix3(mat.Column0, mat.Column1, mat.Column2);
}
-
+
+ /// <summary>
+ /// Calculate the transpose of the given matrix
+ /// </summary>
+ /// <param name="mat">The matrix to transpose</param>
+ /// <param name="result">The result of the calculation</param>
public static void Transpose(ref Matrix3 mat, out Matrix3 result)
{
- result.Row0 = mat.Column0;
- result.Row1 = mat.Column1;
- result.Row2 = mat.Column2;
+ result.Row0.X = mat.Row0.X;
+ result.Row0.Y = mat.Row1.X;
+ result.Row0.Z = mat.Row2.X;
+ result.Row1.X = mat.Row0.Y;
+ result.Row1.Y = mat.Row1.Y;
+ result.Row1.Z = mat.Row2.Y;
+ result.Row2.X = mat.Row0.Z;
+ result.Row2.Y = mat.Row1.Z;
+ result.Row2.Z = mat.Row2.Z;
}
#endregion
public double M33 { get { return Row2.Z; } set { Row2.Z = value; } }
#endregion
-
+
+ #region Indexers
+
+ /// <summary>
+ /// Gets or sets the value at a specified row and column.
+ /// </summary>
+ public double this[int rowIndex, int columnIndex]
+ {
+ get
+ {
+ if (rowIndex == 0) return Row0[columnIndex];
+ else if (rowIndex == 1) return Row1[columnIndex];
+ else if (rowIndex == 2) return Row2[columnIndex];
+ throw new IndexOutOfRangeException("You tried to access this matrix at: (" + rowIndex + ", " + columnIndex + ")");
+ }
+ set
+ {
+ if (rowIndex == 0) Row0[columnIndex] = value;
+ else if (rowIndex == 1) Row1[columnIndex] = value;
+ else if (rowIndex == 2) Row2[columnIndex] = value;
+ throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")");
+ }
+ }
+
+ #endregion
+
#region Instance
-
+
#region public void Invert()
+ /// <summary>
+ /// Converts this instance into its inverse.
+ /// </summary>
public void Invert()
{
this = Matrix3d.Invert(this);