The Open Toolkit library  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
OpenTK.Matrix2 Struct Reference

Represents a 2x2 matrix More...

Inherits IEquatable< Matrix2 >.

Public Member Functions

 Matrix2 (Vector2 row0, Vector2 row1)
 Constructs a new instance. More...
 
 Matrix2 (float m00, float m01, float m10, float m11)
 Constructs a new instance More...
 
void Transpose ()
 Converts this instance to it's transpose. More...
 
void Invert ()
 Converts this instance into its inverse. More...
 
override string ToString ()
 Returns a System.String that represents the current Matrix4. More...
 
override int GetHashCode ()
 Returns the hashcode for this instance. More...
 
override bool Equals (object obj)
 Indicates whether this instance and a specified object are equal. More...
 
bool Equals (Matrix2 other)
 Indicates whether the current matrix is equal to another matrix. More...
 

Static Public Member Functions

static void CreateRotation (float angle, out Matrix2 result)
 Builds a rotation matrix. More...
 
static Matrix2 CreateRotation (float angle)
 Builds a rotation matrix. More...
 
static void CreateScale (float scale, out Matrix2 result)
 Creates a scale matrix. More...
 
static Matrix2 CreateScale (float scale)
 Creates a scale matrix. More...
 
static void CreateScale (Vector2 scale, out Matrix2 result)
 Creates a scale matrix. More...
 
static Matrix2 CreateScale (Vector2 scale)
 Creates a scale matrix. More...
 
static void CreateScale (float x, float y, out Matrix2 result)
 Creates a scale matrix. More...
 
static Matrix2 CreateScale (float x, float y)
 Creates a scale matrix. More...
 
static void Mult (ref Matrix2 left, float right, out Matrix2 result)
 Multiplies and instance by a scalar. More...
 
static Matrix2 Mult (Matrix2 left, float right)
 Multiplies and instance by a scalar. More...
 
static void Mult (ref Matrix2 left, ref Matrix2 right, out Matrix2 result)
 Multiplies two instances. More...
 
static Matrix2 Mult (Matrix2 left, Matrix2 right)
 Multiplies two instances. More...
 
static void Mult (ref Matrix2 left, ref Matrix2x3 right, out Matrix2x3 result)
 Multiplies two instances. More...
 
static Matrix2x3 Mult (Matrix2 left, Matrix2x3 right)
 Multiplies two instances. More...
 
static void Mult (ref Matrix2 left, ref Matrix2x4 right, out Matrix2x4 result)
 Multiplies two instances. More...
 
static Matrix2x4 Mult (Matrix2 left, Matrix2x4 right)
 Multiplies two instances. More...
 
static void Add (ref Matrix2 left, ref Matrix2 right, out Matrix2 result)
 Adds two instances. More...
 
static Matrix2 Add (Matrix2 left, Matrix2 right)
 Adds two instances. More...
 
static void Subtract (ref Matrix2 left, ref Matrix2 right, out Matrix2 result)
 Subtracts two instances. More...
 
static Matrix2 Subtract (Matrix2 left, Matrix2 right)
 Subtracts two instances. More...
 
static void Invert (ref Matrix2 mat, out Matrix2 result)
 Calculate the inverse of the given matrix More...
 
static Matrix2 Invert (Matrix2 mat)
 Calculate the inverse of the given matrix More...
 
static void Transpose (ref Matrix2 mat, out Matrix2 result)
 Calculate the transpose of the given matrix. More...
 
static Matrix2 Transpose (Matrix2 mat)
 Calculate the transpose of the given matrix. More...
 
static Matrix2 operator* (float left, Matrix2 right)
 Scalar multiplication. More...
 
static Matrix2 operator* (Matrix2 left, float right)
 Scalar multiplication. More...
 
static Matrix2 operator* (Matrix2 left, Matrix2 right)
 Matrix multiplication More...
 
static Matrix2x3 operator* (Matrix2 left, Matrix2x3 right)
 Matrix multiplication More...
 
static Matrix2x4 operator* (Matrix2 left, Matrix2x4 right)
 Matrix multiplication More...
 
static Matrix2 operator+ (Matrix2 left, Matrix2 right)
 Matrix addition More...
 
static Matrix2 operator- (Matrix2 left, Matrix2 right)
 Matrix subtraction More...
 
static bool operator== (Matrix2 left, Matrix2 right)
 Compares two instances for equality. More...
 
static bool operator!= (Matrix2 left, Matrix2 right)
 Compares two instances for inequality. More...
 

Public Attributes

Vector2 Row0
 Top row of the matrix. More...
 
Vector2 Row1
 Bottom row of the matrix. More...
 

Static Public Attributes

static readonly Matrix2 Identity = new Matrix2(Vector2.UnitX, Vector2.UnitY)
 The identity matrix. More...
 
static readonly Matrix2 Zero = new Matrix2(Vector2.Zero, Vector2.Zero)
 The zero matrix. More...
 

Properties

float Determinant [get]
 Gets the determinant of this matrix. More...
 
Vector2 Column0 [get, set]
 Gets or sets the first column of this matrix. More...
 
Vector2 Column1 [get, set]
 Gets or sets the second column of this matrix. More...
 
float M11 [get, set]
 Gets or sets the value at row 1, column 1 of this instance. More...
 
float M12 [get, set]
 Gets or sets the value at row 1, column 2 of this instance. More...
 
float M21 [get, set]
 Gets or sets the value at row 2, column 1 of this instance. More...
 
float M22 [get, set]
 Gets or sets the value at row 2, column 2 of this instance. More...
 
Vector2 Diagonal [get, set]
 Gets or sets the values along the main diagonal of the matrix. More...
 
float Trace [get]
 Gets the trace of the matrix, the sum of the values along the diagonal. More...
 
float this[int rowIndex, int columnIndex] [get, set]
 Gets or sets the value at a specified row and column. More...
 

Detailed Description

Represents a 2x2 matrix

Constructor & Destructor Documentation

OpenTK.Matrix2.Matrix2 ( Vector2  row0,
Vector2  row1 
)

Constructs a new instance.

Parameters
row0Top row of the matrix.
row1Bottom row of the matrix.
OpenTK.Matrix2.Matrix2 ( float  m00,
float  m01,
float  m10,
float  m11 
)

Constructs a new instance

Parameters
m00First item of the first row of the matrix.
m01Second item of the first row of the matrix.
m10First item of the second row of the matrix.
m11Second item of the second row of the matrix.

Member Function Documentation

static void OpenTK.Matrix2.Add ( ref Matrix2  left,
ref Matrix2  right,
out Matrix2  result 
)
static

Adds two instances.

Parameters
leftThe left operand of the addition.
rightThe right operand of the addition.
resultA new instance that is the result of the addition.
static Matrix2 OpenTK.Matrix2.Add ( Matrix2  left,
Matrix2  right 
)
static

Adds two instances.

Parameters
leftThe left operand of the addition.
rightThe right operand of the addition.
Returns
A new instance that is the result of the addition.
static void OpenTK.Matrix2.CreateRotation ( float  angle,
out Matrix2  result 
)
static

Builds a rotation matrix.

Parameters
angleThe counter-clockwise angle in radians.
resultThe resulting Matrix2 instance.
static Matrix2 OpenTK.Matrix2.CreateRotation ( float  angle)
static

Builds a rotation matrix.

Parameters
angleThe counter-clockwise angle in radians.
Returns
The resulting Matrix2 instance.
static void OpenTK.Matrix2.CreateScale ( float  scale,
out Matrix2  result 
)
static

Creates a scale matrix.

Parameters
scaleSingle scale factor for the x, y, and z axes.
resultA scale matrix.
static Matrix2 OpenTK.Matrix2.CreateScale ( float  scale)
static

Creates a scale matrix.

Parameters
scaleSingle scale factor for the x and y axes.
Returns
A scale matrix.
static void OpenTK.Matrix2.CreateScale ( Vector2  scale,
out Matrix2  result 
)
static

Creates a scale matrix.

Parameters
scaleScale factors for the x and y axes.
resultA scale matrix.
static Matrix2 OpenTK.Matrix2.CreateScale ( Vector2  scale)
static

Creates a scale matrix.

Parameters
scaleScale factors for the x and y axes.
Returns
A scale matrix.
static void OpenTK.Matrix2.CreateScale ( float  x,
float  y,
out Matrix2  result 
)
static

Creates a scale matrix.

Parameters
xScale factor for the x axis.
yScale factor for the y axis.
resultA scale matrix.
static Matrix2 OpenTK.Matrix2.CreateScale ( float  x,
float  y 
)
static

Creates a scale matrix.

Parameters
xScale factor for the x axis.
yScale factor for the y axis.
Returns
A scale matrix.
override bool OpenTK.Matrix2.Equals ( object  obj)

Indicates whether this instance and a specified object are equal.

Parameters
objThe object to compare to.
Returns
True if the instances are equal; false otherwise.
bool OpenTK.Matrix2.Equals ( Matrix2  other)

Indicates whether the current matrix is equal to another matrix.

Parameters
otherAn matrix to compare with this matrix.
Returns
true if the current matrix is equal to the matrix parameter; otherwise, false.
override int OpenTK.Matrix2.GetHashCode ( )

Returns the hashcode for this instance.

Returns
A System.Int32 containing the unique hashcode for this instance.
void OpenTK.Matrix2.Invert ( )

Converts this instance into its inverse.

static void OpenTK.Matrix2.Invert ( ref Matrix2  mat,
out Matrix2  result 
)
static

Calculate the inverse of the given matrix

Parameters
matThe matrix to invert
resultThe inverse of the given matrix if it has one, or the input if it is singular
Exceptions
InvalidOperationExceptionThrown if the Matrix2 is singular.
static Matrix2 OpenTK.Matrix2.Invert ( Matrix2  mat)
static

Calculate the inverse of the given matrix

Parameters
matThe matrix to invert
Returns
The inverse of the given matrix if it has one, or the input if it is singular
Exceptions
InvalidOperationExceptionThrown if the Matrix2 is singular.
static void OpenTK.Matrix2.Mult ( ref Matrix2  left,
float  right,
out Matrix2  result 
)
static

Multiplies and instance by a scalar.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
resultA new instance that is the result of the multiplication.
static Matrix2 OpenTK.Matrix2.Mult ( Matrix2  left,
float  right 
)
static

Multiplies and instance by a scalar.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
Returns
A new instance that is the result of the multiplication.
static void OpenTK.Matrix2.Mult ( ref Matrix2  left,
ref Matrix2  right,
out Matrix2  result 
)
static

Multiplies two instances.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
resultA new instance that is the result of the multiplication.
static Matrix2 OpenTK.Matrix2.Mult ( Matrix2  left,
Matrix2  right 
)
static

Multiplies two instances.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
Returns
A new instance that is the result of the multiplication.
static void OpenTK.Matrix2.Mult ( ref Matrix2  left,
ref Matrix2x3  right,
out Matrix2x3  result 
)
static

Multiplies two instances.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
resultA new instance that is the result of the multiplication.
static Matrix2x3 OpenTK.Matrix2.Mult ( Matrix2  left,
Matrix2x3  right 
)
static

Multiplies two instances.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
Returns
A new instance that is the result of the multiplication.
static void OpenTK.Matrix2.Mult ( ref Matrix2  left,
ref Matrix2x4  right,
out Matrix2x4  result 
)
static

Multiplies two instances.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
resultA new instance that is the result of the multiplication.
static Matrix2x4 OpenTK.Matrix2.Mult ( Matrix2  left,
Matrix2x4  right 
)
static

Multiplies two instances.

Parameters
leftThe left operand of the multiplication.
rightThe right operand of the multiplication.
Returns
A new instance that is the result of the multiplication.
static bool OpenTK.Matrix2.operator!= ( Matrix2  left,
Matrix2  right 
)
static

Compares two instances for inequality.

Parameters
leftThe first instance.
rightThe second instance.
Returns
True, if left does not equal right; false otherwise.
static Matrix2 OpenTK.Matrix2.operator* ( float  left,
Matrix2  right 
)
static

Scalar multiplication.

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2 which holds the result of the multiplication
static Matrix2 OpenTK.Matrix2.operator* ( Matrix2  left,
float  right 
)
static

Scalar multiplication.

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2 which holds the result of the multiplication
static Matrix2 OpenTK.Matrix2.operator* ( Matrix2  left,
Matrix2  right 
)
static

Matrix multiplication

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2 which holds the result of the multiplication
static Matrix2x3 OpenTK.Matrix2.operator* ( Matrix2  left,
Matrix2x3  right 
)
static

Matrix multiplication

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2x3 which holds the result of the multiplication
static Matrix2x4 OpenTK.Matrix2.operator* ( Matrix2  left,
Matrix2x4  right 
)
static

Matrix multiplication

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2x4 which holds the result of the multiplication
static Matrix2 OpenTK.Matrix2.operator+ ( Matrix2  left,
Matrix2  right 
)
static

Matrix addition

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2 which holds the result of the addition
static Matrix2 OpenTK.Matrix2.operator- ( Matrix2  left,
Matrix2  right 
)
static

Matrix subtraction

Parameters
leftleft-hand operand
rightright-hand operand
Returns
A new Matrix2 which holds the result of the subtraction
static bool OpenTK.Matrix2.operator== ( Matrix2  left,
Matrix2  right 
)
static

Compares two instances for equality.

Parameters
leftThe first instance.
rightThe second instance.
Returns
True, if left equals right; false otherwise.
static void OpenTK.Matrix2.Subtract ( ref Matrix2  left,
ref Matrix2  right,
out Matrix2  result 
)
static

Subtracts two instances.

Parameters
leftThe left operand of the subtraction.
rightThe right operand of the subtraction.
resultA new instance that is the result of the subtraction.
static Matrix2 OpenTK.Matrix2.Subtract ( Matrix2  left,
Matrix2  right 
)
static

Subtracts two instances.

Parameters
leftThe left operand of the subtraction.
rightThe right operand of the subtraction.
Returns
A new instance that is the result of the subtraction.
override string OpenTK.Matrix2.ToString ( )

Returns a System.String that represents the current Matrix4.

Returns
The string representation of the matrix.
void OpenTK.Matrix2.Transpose ( )

Converts this instance to it's transpose.

static void OpenTK.Matrix2.Transpose ( ref Matrix2  mat,
out Matrix2  result 
)
static

Calculate the transpose of the given matrix.

Parameters
matThe matrix to transpose.
resultThe transpose of the given matrix.
static Matrix2 OpenTK.Matrix2.Transpose ( Matrix2  mat)
static

Calculate the transpose of the given matrix.

Parameters
matThe matrix to transpose.
Returns
The transpose of the given matrix.

Member Data Documentation

readonly Matrix2 OpenTK.Matrix2.Identity = new Matrix2(Vector2.UnitX, Vector2.UnitY)
static

The identity matrix.

Vector2 OpenTK.Matrix2.Row0

Top row of the matrix.

Vector2 OpenTK.Matrix2.Row1

Bottom row of the matrix.

readonly Matrix2 OpenTK.Matrix2.Zero = new Matrix2(Vector2.Zero, Vector2.Zero)
static

The zero matrix.

Property Documentation

Vector2 OpenTK.Matrix2.Column0
getset

Gets or sets the first column of this matrix.

Vector2 OpenTK.Matrix2.Column1
getset

Gets or sets the second column of this matrix.

float OpenTK.Matrix2.Determinant
get

Gets the determinant of this matrix.

Vector2 OpenTK.Matrix2.Diagonal
getset

Gets or sets the values along the main diagonal of the matrix.

float OpenTK.Matrix2.M11
getset

Gets or sets the value at row 1, column 1 of this instance.

float OpenTK.Matrix2.M12
getset

Gets or sets the value at row 1, column 2 of this instance.

float OpenTK.Matrix2.M21
getset

Gets or sets the value at row 2, column 1 of this instance.

float OpenTK.Matrix2.M22
getset

Gets or sets the value at row 2, column 2 of this instance.

float OpenTK.Matrix2.this[int rowIndex, int columnIndex]
getset

Gets or sets the value at a specified row and column.

float OpenTK.Matrix2.Trace
get

Gets the trace of the matrix, the sum of the values along the diagonal.