# Unigine.mat2 Struct

Notice
The functions listed below are the members of the Unigine.MathLib namespace.

## floatm00#

The Matrix element in the corresponding row and column mxy = M[x, y]. Provides convenient access to matrix elements.

## floatm10#

The Matrix element in the corresponding row and column mxy = M[x, y]. Provides convenient access to matrix elements.

## floatm01#

The Matrix element in the corresponding row and column mxy = M[x, y]. Provides convenient access to matrix elements.

## floatm11#

The Matrix element in the corresponding row and column mxy = M[x, y]. Provides convenient access to matrix elements.

## mat2ZERO#

The Matrix, filled with zeros (0).

## mat2ONE#

The Matrix, filled with ones (1).

## mat2IDENTITY#

The Identity matrix.

The First row.

The Second row.

## vec2Column0#

The First column.

## vec2Column1#

The Second column.

The X axis.

The Y axis.

## vec2Diagonal#

The Vector containing diagonal elements of the matrix.

## floatTrace#

The Trace of the matrix: (sum of its diagonal elements).

## floatDeterminant#

The Determinant of the matrix.

## booloperator== ( mat2 v0, mat2 v1 ) #

Performs equal comparison.

### Arguments

• mat2 v0 - First value.
• mat2 v1 - Second value.

## booloperator!= ( mat2 v0, mat2 v1 ) #

Not equal comparison.

### Arguments

• mat2 v0 - First value.
• mat2 v1 - Second value.

## boolEquals ( mat2 other ) #

Checks if the vector and the specified argument are equal (epsilon).

### Arguments

• mat2 other - Value to be checked for equality.

Return value.

## boolEquals ( object obj ) #

Checks if the vector and the specified argument are equal (epsilon).

Return value.

## intGetHashCode ( ) #

Returns a hash code for the current object. Serves as the default hash function.

### Return value

Resulting int value.

Subtraction.

## mat2operator* ( mat2 m, float v ) #

Multiplication.

### Arguments

• mat2 m - Matrix.
• float v - Value.

Multiplication.

Multiplication.

Multiplication.

Multiplication.

## mat2operator* ( mat2 m0, mat2 m1 ) #

Matrices multiplication.

### Arguments

• mat2 m0 - First matrix.
• mat2 m1 - Second matrix.

Result matrix.

## mat2operator+ ( mat2 m0, mat2 m1 ) #

### Arguments

• mat2 m0 - First matrix.
• mat2 m1 - Second matrix.

## mat2operator- ( mat2 m0, mat2 m1 ) #

Matrices subtraction.

### Arguments

• mat2 m0 - First matrix.
• mat2 m1 - Second matrix.

## voidSet ( float m00_, float m10_, float m01_, float m11_ ) #

Sets the value using the specified argument(s).

### Arguments

• float m00_ - m00_ element.
• float m10_ - m10_ element.
• float m01_ - m01_ element.
• float m11_ - m11_ element.

## voidSet ( float v ) #

Sets the value using the specified argument(s).

### Arguments

• float v - A float value to be used.

## voidSet ( float[] m ) #

Sets the value using the specified argument(s).

### Arguments

• float[] m - Source matrix.

## voidSet ( mat2 m ) #

Sets the value using the specified argument(s).

### Arguments

• mat2 m - Source matrix.

## voidSet ( mat3 m ) #

Sets the value using the specified argument(s).

### Arguments

• mat3 m - Source matrix.

## voidSet ( mat4 m ) #

Sets the value using the specified argument(s).

### Arguments

• mat4 m - Source matrix.

## voidSet ( dmat4 m ) #

Sets the value using the specified argument(s).

## voidSet ( vec2 col0, vec2 col1 ) #

Sets the value using the specified argument(s).

### Arguments

• vec2 col0 - First column.
• vec2 col1 - Second column.

## voidSetRow ( int row, vec2 v ) #

Sets the specified row of the matrix using a given vec2 vector as a source.

### Arguments

• int row - Row index.
• vec2 v - Source vector.

## vec2GetRow ( int row ) #

Returns the specified matrix row.

### Arguments

• int row - Row index.

Return value.

## voidSetColumn ( int column, vec2 v ) #

Sets the specified column of the matrix using a given vec2 vector as a source.

### Arguments

• int column - Column index.
• vec2 v - Source vector.

## vec2GetColumn ( int column ) #

Returns the specified matrix column.

### Arguments

• int column - Column index.

Return value.

## floatGet ( int row, int column ) #

Returns the matrix element specified by given row and column.

### Arguments

• int row - Row index.
• int column - Column index.

### Return value

Resulting float value.

## floatSet ( int row, int column, float v ) #

Sets the value using the specified argument(s).

### Arguments

• int row - Row index.
• int column - Column index.
• float v - A float value to be used.

### Return value

Resulting float value.

## voidClear ( ) #

Clears the value by setting all components/elements to 0.

## voidSetZero ( ) #

Sets all matrix elements equal to 0.

## voidSetIdentity ( ) #

Sets the matrix equal to the identity matrix.

## voidSetRotate ( float angle ) #

Fills the rotation matrix using a given angle.
Output
``````Rotation matrix:
| cos(angle)   	-sin(angle) |
R=  | sin(angle)     cos(angle) |``````

### Arguments

• float angle - Angle, in degrees.

## voidSetScale ( vec2 v ) #

Fills the scaling matrix using a given vec2 source vector.
Output
``````Scaling matrix:
| v.x   	0.0f |
S=  | 0.0f      v.y  |``````

### Arguments

• vec2 v - Source vector.

## stringToString ( ) #

Converts the current value to a string value.

### Return value

Resulting string value.
Last update: 2023-12-19