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

Unigine::mat3 Class

Header:#include <UnigineMathLib.h>

mat3 Class

Members


mat3()

Default constructor that produces an identity matrix.

mat3(const mat3 & m)

Constructor that initializes new matrix by given one.

Arguments

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

mat3(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.

mat3(const mat2 & m)

Constructor that initialized new matrix by given mat3 matrix. It uses m00, m01, m10, m11 values from the source matrix.
Source code
m00 = m.m00;
m01 = m.m01;
m02 = 0.0f;
m10 = m.m10;
m11 = m.m11;
m12 = 0.0f;
m20 = 0.0f;
m21 = 0.0f;
m22 = 1.0f;

Arguments

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

mat3(const mat4 & m)

Constructor that initializes new matrix. The matrix values are filled by using corresponding values of the given mat4 matrix.

Arguments

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

mat3(const dmat4 & m)

Constructor that initializes new matrix. The matrix values are filled by using corresponding values of the given dmat4 matrix.

Arguments

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

mat3(const quat & q)

Constructor that initializes new matrix. The matrix values are filled by using corresponding values of the given dmat4 matrix.

Arguments

  • const quat & q - quat struct as a source for the new matrix.

mat3(const float * m)

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

Arguments

  • const float * m - Float value to fill the new matrix.

mat3(const vec3 & col0, const vec3 & col1, const vec3 & col2)

Constructor that initialized new matrix by given two vec2 vectors. It uses the following formula:
Source code
m00 = c0.x;
m01 = c1.x;
m02 = c2.x;
m10 = c0.y;
m11 = c1.y;
m12 = c2.y;
m20 = c0.z;
m21 = c1.z;
m22 = c2.z;

Arguments

  • const vec3 & col0 - vec3 for the first column values.
  • const vec3 & col1 - vec3 for the second column values.
  • const vec3 & col2 - vec3 for the third column values

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

Sets new value by specifying row and column of mat3 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.

void set(const dmat4 & m)

Sets new matrix values by using dmat4.

Arguments

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

void set(const mat4 & m)

Sets new matrix values by using mat4.

Arguments

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

void set(const float * m)

Sets new matrix values by using pointer.

Arguments

  • const float * m - Constant pointer to the matrix.

void set(const quat & q)

Sets new matrix my using quaternion values.

Arguments

  • const quat & q - Quaternion as a source for the matrix.

void set(const mat3 & m)

Sets new matrix values by using mat3.

Arguments

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

void set(const mat2 & m)

Sets new matrix values by using mat2.

Arguments

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

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.

float & get(int row, int column)

Returns a reference matrix 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 matrix 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 get(float * m)

Fills the destination matrix pointer with the source matrix values.

Arguments

  • float * m - Destination matrix pointer.

vec3 getBack()

void setColumn(int column, const vec3 & v)

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

Arguments

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

vec3 getColumn(int column)

Returns the matrix column.

Arguments

  • int column - The number of the column.

Return value

The vec3 vector with column values.

void setDiagonal(const vec3 & v)

Sets the main diagonal of the matrix: m00, m11, m22 values.

Arguments

  • const vec3 & v - vec3 vector to be set as main diagonal of the matrix.

vec3 getDiagonal()

Returns the main diagonal of the matrix: m00, m11, m22 values.

Return value

The ve3 vector with diagonal values.

vec3 getDown()

vec3 getForward()

void setIdentity()

Changes matrix values to the identity.

vec3 getLeft()

quat getQuat()

Returns the quaternion of the matrix values.

Return value

Quaternion.

vec3 getRight()

void setRotate(const vec3 & axis, float angle)

Sets the rotation matrix.

Arguments

  • const vec3 & axis - Rotation axis.
  • float angle - Rotation angle (in degrees).

void setRotateX(float angle)

Sets the X rotation matrix.

Arguments

  • float angle - Rotation angle (in degrees).

void setRotateY(float angle)

Sets the Y rotation matrix.

Arguments

  • float angle - Rotation angle (in degrees).

void setRotateZ(float angle)

Sets the Z rotation matrix.

Arguments

  • float angle - Rotation angle (in degrees).

void setRow(int row, const vec3 & v)

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

Arguments

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

vec3 getRow(int row)

Returns the matrix row.

Arguments

  • int row - The number of the row.

Return value

The vec3 vector with row values.

void setScale(const vec3 & v)

Sets the scale matrix.

Arguments

  • const vec3 & v - The value of the scaling vector.

void setSkewSymmetric(const vec3 & v)

Fills the matrix with given values by using the following formula:
Source code
m00 = 0.0f;
m01 = -v.z;
m02 = v.y;
m10 = v.z;
m11 = 0.0;
m12 = -v.x;
m20 = -v.y;
m21 = v.x;
m22 = 0.0;

Arguments

  • const vec3 & v - vec3 value.

vec3 getUp()

void setZero()

Sets all matrix values to 0.

const float * operator const float *()

const void * operator const void *()

float * operator float *()

void * operator void *()

mat3 & operator*=(float v)

Performs matrix multiplication.

Arguments

  • float v - Value.

Return value

The resulting matrix.

mat3 & operator*=(const mat3 & m)

Performs matrix multiplication.

Arguments

  • const mat3 & m - mat3 matrix.

Return value

The resulting matrix.

mat3 & operator+=(const mat3 & m)

Performs matrix addition.

Arguments

  • const mat3 & m - mat3 matrix.

Return value

The resulting matrix.

mat3 operator-()

Performs sign changing (unary minus operation).

Return value

The resulting matrix.

mat3 & operator-=(const mat3 & m)

Performs matrix subtraction.

Arguments

  • const mat3 & m - mat3 matrix.

Return value

The resulting matrix.

mat3 & operator=(const mat3 & m)

Performs matrix assignment. Source matrix = Destination matrix.

Arguments

  • const mat3 & 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.

void sse(const __m128 & v0, const __m128 & v1, const __m128 & v2)

Arguments

  • const __m128 & v0
  • const __m128 & v1
  • const __m128 & v2

void sse0(const __m128 & v)

Arguments

  • const __m128 & v

__m128 sse0()

__m128 sse1()

void sse1(const __m128 & v)

Arguments

  • const __m128 & v

__m128 sse2()

void sse2(const __m128 & v)

Arguments

  • const __m128 & v

int IDENTITY

int ONE

int ZERO

Last update: 2017-07-03