CVB.Net 15.0
Matrix2D Struct Reference

Double precision 2x2 Matrix struct. More...

Public Member Functions

 Matrix2D (double a11, double a12, double a21, double a22)
 Construct a 2x2 matrix. More...
 
 Matrix2D (Angle rotation)
 Construct a 2x2 matrix that represents a rotation. More...
 
 Matrix2D (Angle rotation, double scale)
 Construct a 2x2 matrix that is a combination of a rotation and scale operation. More...
 
 Matrix2D (double scale)
 Construct a 2x2 matrix that represents a scaling. More...
 
 Matrix2D (double scaleX, double scaleY)
 Constructs a 2x2 matrix that represent a scaling with different scaling in x and y directions. More...
 
 Matrix2D (Point2Dd column1, Point2Dd column2)
 Construct a 2x2 matrix from two column vectors. More...
 
void Invert ()
 Invert this matrix in-place if possible. More...
 
Matrix2D Inverse ()
 Get the inverse of this matrix if possible. More...
 
override bool Equals (object obj)
 Comparison function. More...
 
override int GetHashCode ()
 Hash code. More...
 
override string ToString ()
 String conversion. More...
 

Static Public Member Functions

static Matrix2D operator- (Matrix2D lhs, Matrix2D rhs)
 Subtraction operator for MatrixD structs. More...
 
static Matrix2D operator+ (Matrix2D lhs, Matrix2D rhs)
 Addition operator for MatrixD structs. More...
 
static Matrix2D operator* (Matrix2D lhs, Matrix2D rhs)
 Multiplication operator for MatrixD structs. More...
 
static bool operator!= (Matrix2D lhs, Matrix2D rhs)
 Comparison operator for MatrixD structs. More...
 
static bool operator== (Matrix2D lhs, Matrix2D rhs)
 Comparison operator for MatrixD structs. More...
 
static Matrix2D operator* (double lhs, Matrix2D rhs)
 Multiplication operator between MatrixD and scalar. More...
 

Static Public Attributes

static readonly Matrix2D Identity = new Matrix2D(1.0, 0.0, 0.0, 1.0)
 1-element for matrix operations.
 
static readonly Matrix2D Empty = new Matrix2D()
 0-element for matrix operations.
 

Properties

double A11 [get, set]
 Top left matrix element.
 
double A12 [get, set]
 Top right matrix element.
 
double A21 [get, set]
 Bottom left matrix element.
 
double A22 [get, set]
 Bottom right matrix element.
 
double this[int row, int column] [get, set]
 Index access. More...
 
double Det [get]
 Matrix determinant.
 

Detailed Description

Double precision 2x2 Matrix struct.

Constructor & Destructor Documentation

◆ Matrix2D() [1/6]

Matrix2D ( double  a11,
double  a12,
double  a21,
double  a22 
)

Construct a 2x2 matrix.

Parameters
a11Top left matrix element
a12Top right matrix element
a21Bottom left matrix element
a22Bottom right matrix element

◆ Matrix2D() [2/6]

Matrix2D ( Angle  rotation)

Construct a 2x2 matrix that represents a rotation.

Parameters
rotationAngle of the rotation

◆ Matrix2D() [3/6]

Matrix2D ( Angle  rotation,
double  scale 
)

Construct a 2x2 matrix that is a combination of a rotation and scale operation.

Parameters
rotationRotation angle to create the matrix for
scaleScale factor to create the matrix for

◆ Matrix2D() [4/6]

Matrix2D ( double  scale)

Construct a 2x2 matrix that represents a scaling.

Parameters
scaleScale factor to create the matrix for.

◆ Matrix2D() [5/6]

Matrix2D ( double  scaleX,
double  scaleY 
)

Constructs a 2x2 matrix that represent a scaling with different scaling in x and y directions.

Parameters
scaleXScale factor in X direction to create the matrix for.
scaleYScale factor in Y direction to create the matrix for.

◆ Matrix2D() [6/6]

Matrix2D ( Point2Dd  column1,
Point2Dd  column2 
)

Construct a 2x2 matrix from two column vectors.

Parameters
column1Column vector one
column2Columns vector two

Member Function Documentation

◆ Equals()

override bool Equals ( object  obj)

Comparison function.

Parameters
objObject to compare to
Returns
true if obj == this, false otherwise

◆ GetHashCode()

override int GetHashCode ( )

Hash code.

Returns
hash code

◆ Inverse()

Matrix2D Inverse ( )

Get the inverse of this matrix if possible.

Returns
Inverse.
Exceptions
DivideByZeroExceptionIf the matrix cannot be inverted.

◆ Invert()

void Invert ( )

Invert this matrix in-place if possible.

Exceptions
DivideByZeroExceptionIf the matrix cannot be inverted.

◆ operator!=()

static bool operator!= ( Matrix2D  lhs,
Matrix2D  rhs 
)
static

Comparison operator for MatrixD structs.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
true lhs != rhs, false otherwise

◆ operator*() [1/2]

static Matrix2D operator* ( double  lhs,
Matrix2D  rhs 
)
static

Multiplication operator between MatrixD and scalar.

Parameters
lhsScalar to multiply the matrix with.
rhsMatrix to be multiplied.
Returns
Multiplication result.

◆ operator*() [2/2]

static Matrix2D operator* ( Matrix2D  lhs,
Matrix2D  rhs 
)
static

Multiplication operator for MatrixD structs.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
Product of lhs and rhs .

◆ operator+()

static Matrix2D operator+ ( Matrix2D  lhs,
Matrix2D  rhs 
)
static

Addition operator for MatrixD structs.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
Sum of lhs and rhs .

◆ operator-()

static Matrix2D operator- ( Matrix2D  lhs,
Matrix2D  rhs 
)
static

Subtraction operator for MatrixD structs.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
Difference of lhs and rhs .

◆ operator==()

static bool operator== ( Matrix2D  lhs,
Matrix2D  rhs 
)
static

Comparison operator for MatrixD structs.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
true lhs == rhs, false otherwise

◆ ToString()

override string ToString ( )

String conversion.

Returns
string representation of this MatrixD

Property Documentation

◆ this[int row, int column]

double this[int row, int column]
getset

Index access.

Parameters
rowThe row, or "Y" index to get.
columnThe column, or "X" index to get.
Returns
Value at the specified position.