This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::mat2 Class

Header:#include <UnigineMathLib.h>

mat2 Class

Members


mat2()

Default constructor that produces an identity matrix.

mat2(const mat2 & m)

Constructor that initializes new matrix by given one.

Arguments

  • const mat2 & m - mat2 matrix as a source for the new matrix.

mat2(float v)

Constructor that initializes new matrix. The matrix values are filled with the given value.

Arguments

  • float v - Float value to fill the new matrix.

mat2(const mat3 & m)

Constructor that initialized new matrix by given mat3 matrix. It uses m00, m01, m10, m11 values from the source matrix.

Arguments

  • const mat3 & m - mat3 matrix as a source for the new matrix.

mat2(const mat4 & m)

Constructor that initialized new matrix by given mat4 matrix. It uses m00, m01, m10, m11 values from the source matrix.

Arguments

  • const mat4 & m - mat3 matrix as a source for the new matrix.

mat2(const dmat4 & m)

Constructor that initialized new matrix by given dmat4 matrix. It uses m00, m01, m10, m11 values from the source matrix.

Arguments

  • const dmat4 & m - dmat3 matrix as a source for the new matrix.

mat2(const float * m)

Constructor that initialized new matrix by given pointer to the matrix.

Arguments

  • const float * m - Pointer to the matrix

mat2(const vec2 & col0, const vec2 & col1)

Constructor that initialized new matrix by given two vec2 vectors. It uses the following formula:
Source code
m00 = col0.x;
m01 = col1.x;
m10 = col0.y;
m11 = col1.y;

Arguments

  • const vec2 & col0 - vec2 for the first column values.
  • const vec2 & col1 - vec2 for the second column values.

void set(const float * m)

Sets new matrix values by using pointer.

Arguments

  • const float * m - Pointer to the matrix.

void set(const mat2 & m)

Sets new matrix values by using mat2.

Arguments

  • const mat2 & m - mat2 matrix as a source for mat2 matrix values.

void set(const mat3 & m)

Sets new matrix values by using mat3.

Arguments

  • const mat3 & m - mat3 matrix as a source for mat2 matrix values.

void set(const mat4 & m)

Sets new matrix values by using mat4.

Arguments

  • const mat4 & m - mat4 matrix as a source for mat2 matrix values.

void set(const dmat4 & m)

Sets new matrix values by using dmat4.

Arguments

  • const dmat4 & m - dmat4 matrix as a source for mat2 matrix values.

void set(int row, int column, float v)

Sets new value by specifying row and column of mat2 matrix.

Arguments

  • int row - The row where to place the value.
  • int column - The column where to place the value.
  • float v - The value to be set.

float * get()

Returns the pointer to the matrix.

Return value

Pointer to the matrix.

const float * get()

Returns the constant pointer to the matrix.

Return value

Constant pointer to the matrix.

void get(float * m)

Fills the destination matrix pointer with the source matrix values.

Arguments

  • float * m - Destination matrix pointer.

float & get(int row, int column)

Returns a reference value specified by given row and column of the matrix.

Arguments

  • int row - The number of row.
  • int column - The number of column.

Return value

Reference value of the matrix.

float get(int row, int column)

Returns the value specified by given row and column of the matrix.

Arguments

  • int row - The number of row.
  • int column - The number of column.

Return value

Value of the matrix.

void setColumn(int column, const vec2 & v)

Sets the given vec2 as the new column of the matrix.

Arguments

  • int column - The number of the column.
  • const vec2 & v - vec2 as a new column for the matrix.

vec2 getColumn(int column)

Returns the matrix column.

Arguments

  • int column - The number of the column.

Return value

The vec2 vector with column values.

void setIdentity()

Changes matrix values to the identity.

void setRotate(float angle)

Fills the matrix values as rotate by using the following formula:
Source code
float s, c;
Math::sincos(angle * DEG2RAD, s, c);
m00 = c;
m01 = -s;
m10 = s;
m11 = c;

Arguments

  • float angle - Angle of rotation value.

void setRow(int row, const vec2 & v)

Sets the given vec2 as the new row of the matrix.

Arguments

  • int row - The number of the row.
  • const vec2 & v - vec2 as a new row for the matrix.

vec2 getRow(int row)

Returns the matrix row.

Arguments

  • int row - The number of the row.

Return value

The vec2 vector with row values.

void setScale(const vec2 & v)

Fills the matrix values as scale by using the following formula:
Source code
m00 = v.x;
m01 = 0.0f;
m10 = 0.0f;
m11 = v.y;

Arguments

  • const vec2 & v - Scale value.

void setZero()

Sets all matrix values to 0.

const float * operator const float *()

const void * operator const void *()

float * operator float *()

void * operator void *()

mat2 & operator*=(const mat2 & m)

Performs matrix multiplication.

Arguments

  • const mat2 & m - mat2 matrix.

Return value

The resulting matrix.

mat2 & operator*=(float v)

Performs matrix multiplication.

Arguments

  • float v - Value.

Return value

The resulting matrix.

mat2 & operator+=(const mat2 & m)

Performs matrix addition.

Arguments

  • const mat2 & m - mat2 matrix.

Return value

The resulting matrix.

mat2 operator-()

Performs sign changing (unary minus operation).

Return value

Source mat2 matrix.

mat2 & operator-=(const mat2 & m)

Performs matrix subtraction.

Arguments

  • const mat2 & m - mat2 matrix.

Return value

The resulting matrix.

mat2 & operator=(const mat2 & m)

Performs matrix assignment. Source matrix = Destination matrix.

Arguments

  • const mat2 & m - Destination matrix.

Return value

Source matrix.

float operator[](int i)

Performs array access to the matrix item by using given item index.

Arguments

  • int i - Index of the matrix item.

Return value

Matrix item.

float & operator[](int i)

Performs array access to the matrix item reference by using given item index.

Arguments

  • int i - Index of the matrix item.

Return value

Matrix item reference.

__m128 sse()

void sse(const __m128 & v)

Arguments

  • const __m128 & v

int IDENTITY

int ONE

int ZERO

Last update: 2017-07-03
Build: ()