Class Matrix
Keeps all the values of a 3 by 3 matrix and allows you to do some math with matrices.
public class Matrix
- Inheritance
-
Matrix
- Inherited Members
Constructors
Matrix()
constructs a new Matrix with identity.
public Matrix()
Matrix(float, float)
Constructs a matrix that represents translation.
public Matrix(float tx, float ty)
Parameters
Matrix(float, float, float, float, float, float)
Creates a Matrix with 6 specified entries.
public Matrix(float a, float b, float c, float d, float e, float f)
Parameters
a
floatelement at (1,1)
b
floatelement at (1,2)
c
floatelement at (2,1)
d
floatelement at (2,2)
e
floatelement at (3,1)
f
floatelement at (3,2)
Remarks
Creates a Matrix with 6 specified entries. The third column will always be [0 0 1] (row, column)
Matrix(float, float, float, float, float, float, float, float, float)
Creates a Matrix with 9 specified entries.
public Matrix(float e11, float e12, float e13, float e21, float e22, float e23, float e31, float e32, float e33)
Parameters
e11
floatelement at position (1,1)
e12
floatelement at position (1,2)
e13
floatelement at position (1,3)
e21
floatelement at position (2,1)
e22
floatelement at position (2,2)
e23
floatelement at position (2,3)
e31
floatelement at position (3,1)
e32
floatelement at position (3,2)
e33
floatelement at position (3,3)
Fields
I11
the row=1, col=1 position ('a') in the matrix.
public const int I11 = 0
Field Value
I12
the row=1, col=2 position ('b') in the matrix.
public const int I12 = 1
Field Value
I13
the row=1, col=3 position (always 0 for 2-D) in the matrix.
public const int I13 = 2
Field Value
I21
the row=2, col=1 position ('c') in the matrix.
public const int I21 = 3
Field Value
I22
the row=2, col=2 position ('d') in the matrix.
public const int I22 = 4
Field Value
I23
the row=2, col=3 position (always 0 for 2-D) in the matrix.
public const int I23 = 5
Field Value
I31
the row=3, col=1 ('e', or X translation) position in the matrix.
public const int I31 = 6
Field Value
I32
the row=3, col=2 ('f', or Y translation) position in the matrix.
public const int I32 = 7
Field Value
I33
the row=3, col=3 position (always 1 for 2-D) in the matrix.
public const int I33 = 8
Field Value
Methods
Add(Matrix)
Adds a matrix from this matrix and returns the results.
public virtual Matrix Add(Matrix arg)
Parameters
arg
Matrixthe matrix to subtract from this matrix
Returns
- Matrix
a Matrix object
Equals(object)
Checks equality of matrices.
public override bool Equals(object obj)
Parameters
obj
objectthe other Matrix that needs to be compared with this matrix.
Returns
- bool
true if both matrices are equal
- See Also
Get(int)
Gets a specific value inside the matrix.
public virtual float Get(int index)
Parameters
index
intan array index corresponding with a value inside the matrix
Returns
- float
the value at that specific position.
Remarks
Gets a specific value inside the matrix.
For reference, the indeces are as follows:I11 I12 I13
I21 I22 I23
I31 I32 I33
GetDeterminant()
Computes the determinant of the matrix.
public virtual float GetDeterminant()
Returns
- float
the determinant of the matrix
GetHashCode()
Generates a hash code for this object.
public override int GetHashCode()
Returns
- int
the hash code of this object
- See Also
Multiply(Matrix)
multiplies this matrix by 'b' and returns the result.
public virtual Matrix Multiply(Matrix by)
Parameters
by
MatrixThe matrix to multiply by
Returns
- Matrix
the resulting matrix
Remarks
multiplies this matrix by 'b' and returns the result. See http://en.wikipedia.org/wiki/Matrix_multiplication
Subtract(Matrix)
Subtracts a matrix from this matrix and returns the results.
public virtual Matrix Subtract(Matrix arg)
Parameters
arg
Matrixthe matrix to subtract from this matrix
Returns
- Matrix
a Matrix object
ToString()
Generates a String representation of the matrix.
public override string ToString()
Returns
- string
the values, delimited with tabs and newlines.
- See Also
-
ToString()