Matrix4

Наследует: None

Описание

Внутренне данные хранятся в column-major формате, что оптимально для передачи в функции OpenGL, которые ожидают column-major данные.

Публичные методы

Matrix4 ()

Matrix4 (const Matrix3 & matrix)

Matrix4 (const Vector3 & position, const Quaternion & rotation, const Vector3 & scale)

areal

determinant () const

void

direction (const Vector3 & direction, const Vector3 & up)

Vector3

euler ()

void

identity ()

Matrix4

inverse () const

Vector3

position () const

void

reflect (const Vector4 & plane)

void

rotate (const Vector3 & axis, areal angle)

void

rotate (const Vector3 & angles)

Matrix3

rotation () const

void

scale (const Vector3 & vector)

void

translate (const Vector3 & vector)

Matrix4

transpose () const

void

zero ()

bool

operator!= (const Matrix4 & matrix) const

Vector3

operator* (const Vector3 & vector) const

Vector4

operator* (const Vector4 & vector) const

Matrix4

operator* (areal factor) const

Matrix4

operator* (const Matrix4 & matrix) const

Matrix4 &

operator*= (areal factor)

Matrix4 &

operator*= (const Matrix4 & matrix)

Matrix4

operator+ (const Matrix4 & matrix) const

Matrix4 &

operator+= (const Matrix4 & matrix)

Matrix4

operator- (const Matrix4 & matrix) const

Matrix4 &

operator-= (const Matrix4 & matrix)

Matrix4 &

operator= (const Matrix4 & value)

bool

operator== (const Matrix4 & matrix) const

areal

operator[] (int i)

areal

operator[] (int i) const

Статические методы

Matrix4

lookAt (const Vector3 & eye, const Vector3 & target, const Vector3 & up)

Matrix4

ortho (areal left, areal right, areal bottom, areal top, areal znear, areal zfar)

Matrix4

perspective (areal fov, areal aspect, areal znear, areal zfar)

Описание методов

Matrix4::Matrix4 ()

Создаёт единичную матрицу.


Matrix4::Matrix4 (Matrix3 & matrix)

Создаёт матрицу преобразования matrix с матрицей вращения.


Matrix4::Matrix4 (Vector3 & position, Quaternion & rotation, Vector3 & scale)

Создаёт матрицу по заданным position, rotation и scale.


areal Matrix4::determinant () const

Возвращает определитель матрицы.


void Matrix4::direction (Vector3 & direction, Vector3 & up)

Создаёт матрицу вращения на основе векторов direction и up.


Vector3 Matrix4::euler ()

Возвращает углы Эйлера, представленные Vector3(pitch, yaw, roll) в градусах поворота.


void Matrix4::identity ()

Сбрасывает эту матрицу в единичную матрицу.


Matrix4 Matrix4::inverse () const

Возвращает инвертированную копию этой матрицы.


Matrix4 Matrix4::lookAt (Vector3 & eye, Vector3 & target, Vector3 & up)

Создаёт матрицу преобразования, соответствующую камере, смотрящей на target из источника. Принимает точку eye, точку target и вектор up.


Matrix4 Matrix4::ortho (areal left, areal right, areal bottom, areal top, areal znear, areal zfar)

Создаёт матрицу ортогональной проекции. Создаёт вид, показывающий область между left, right, top и bottom, где znear и zfar задают плоскости отсечения по глубине.


Matrix4 Matrix4::perspective (areal fov, areal aspect, areal znear, areal zfar)

Создаёт матрицу перспективной проекции. fov — вертикальное поле зрения в градусах перспективной матрицы, aspect — соотношение сторон (ширина, делённая на высоту). znear и zfar задают плоскости отсечения по глубине.


Vector3 Matrix4::position () const

Возвращает компонент позиции матрицы.


void Matrix4::reflect (Vector4 & plane)

Создаёт матрицу, отражающую систему координат относительно плоскости.


void Matrix4::rotate (Vector3 & axis, areal angle)

Поворачивает эту матрицу вокруг axis на angle в градусах.


void Matrix4::rotate (Vector3 & angles)

Поворачивает эту матрицу с помощью углов Эйлера angles, представленных Vector3(pitch, yaw, roll) в градусах.


Matrix3 Matrix4::rotation () const

Возвращает матрицу вращения из этой матрицы.


void Matrix4::scale (Vector3 & vector)

Масштабирует систему координат с помощью vector.


void Matrix4::translate (Vector3 & vector)

Перемещает систему координат в vector.


Matrix4 Matrix4::transpose () const

Возвращает эту матрицу, транспонированную относительно её диагонали.


void Matrix4::zero ()

Очищает эту матрицу, устанавливая 0.0 для всех компонентов.


bool Matrix4::operator!= (Matrix4 & matrix) const

Возвращает true, если эта matrix НЕ равна заданной матрице; иначе возвращает false. Этот оператор использует точное сравнение с плавающей запятой.


Vector3 Matrix4::operator* (Vector3 & vector) const

Возвращает результат умножения этой матрицы на заданный 3D-вектор.


Vector4 Matrix4::operator* (Vector4 & vector) const

Возвращает результат умножения этой матрицы на заданный 4D-вектор.


Matrix4 Matrix4::operator* (areal factor) const

Возвращает результат умножения этой матрицы на заданный коэффициент.


Matrix4 Matrix4::operator* (Matrix4 & matrix) const

Возвращает результат умножения этой matrix на заданную матрицу.

Обратите внимание, что умножение matrix не коммутативно, т.е. a*b != b*a.


Matrix4 & Matrix4::operator*= (areal factor)

Умножает все элементы этой матрицы на factor.


Matrix4 & Matrix4::operator*= (Matrix4 & matrix)

Возвращает результат умножения этой matrix на заданную матрицу.


Matrix4 Matrix4::operator+ (Matrix4 & matrix) const

Возвращает сумму этой matrix и заданной матрицы.


Matrix4 & Matrix4::operator+= (Matrix4 & matrix)

Добавляет содержимое matrix к этой матрице.


Matrix4 Matrix4::operator- (Matrix4 & matrix) const

Возвращает разность этой matrix и заданной матрицы.


Matrix4 & Matrix4::operator-= (Matrix4 & matrix)

Вычитает содержимое matrix из этой матрицы.


Matrix4 & Matrix4::operator= (Matrix4 & value)

Оператор присваивания. value будет присвоено этому объекту.


bool Matrix4::operator== (Matrix4 & matrix) const

Returns true if this matrix is equal to given matrix; otherwise returns false. This operator uses an exact floating-point comparison.


areal Matrix4::operator[] (int i)

Returns the component of the matrix at index position i as a modifiable reference. i must be a valid index position in the matrix (i.e., 0 <= i < 16). Data is stored as column-major format so this function retrieving data from rows in colmns.

areal Matrix4::operator[] (int i) const

Returns the component of the matrix at index position. i must be a valid index position in the matrix (i.e., 0 <= i < 16). Data is stored as column-major format so this function retrieving data from rows in colmns.