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) |
euler () |
|
void |
identity () |
inverse () const |
|
position () const |
|
void |
reflect (const Vector4 & plane) |
void |
rotate (const Vector3 & axis, areal angle) |
void |
rotate (const Vector3 & angles) |
rotation () const |
|
void |
scale (const Vector3 & vector) |
void |
translate (const Vector3 & vector) |
transpose () const |
|
void |
zero () |
bool |
operator!= (const Matrix4 & matrix) const |
operator* (const Vector3 & vector) const |
|
operator* (const Vector4 & vector) const |
|
operator* (areal factor) const |
|
operator* (const Matrix4 & matrix) const |
|
Matrix4 & |
operator*= (areal factor) |
Matrix4 & |
operator*= (const Matrix4 & matrix) |
operator+ (const Matrix4 & matrix) const |
|
Matrix4 & |
operator+= (const Matrix4 & matrix) |
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::Matrix4 ()
Создаёт единичную матрицу.
Matrix4::Matrix4 (Matrix3 & matrix)
Создаёт матрицу преобразования matrix с матрицей вращения.
Matrix4::Matrix4 (Vector3 & position, Quaternion & rotation, Vector3 & scale)
Создаёт матрицу по заданным position, rotation и scale.
areal Matrix4::determinant () const
Возвращает определитель матрицы.
Создаёт матрицу вращения на основе векторов direction и up.
Vector3 Matrix4::euler ()
Возвращает углы Эйлера, представленные Vector3(pitch, yaw, roll) в градусах поворота.
void Matrix4::identity ()
Сбрасывает эту матрицу в единичную матрицу.
Matrix4 Matrix4::inverse () const
Возвращает инвертированную копию этой матрицы.
Создаёт матрицу преобразования, соответствующую камере, смотрящей на 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. Этот оператор использует точное сравнение с плавающей запятой.
Возвращает результат умножения этой матрицы на заданный 3D-вектор.
Возвращает результат умножения этой матрицы на заданный 4D-вектор.
Matrix4 Matrix4::operator* (areal factor) const
Возвращает результат умножения этой матрицы на заданный коэффициент.
Возвращает результат умножения этой matrix на заданную матрицу.
Обратите внимание, что умножение matrix не коммутативно, т.е. a*b != b*a.
Matrix4 & Matrix4::operator*= (areal factor)
Умножает все элементы этой матрицы на factor.
Возвращает результат умножения этой matrix на заданную матрицу.
Возвращает сумму этой matrix и заданной матрицы.
Добавляет содержимое matrix к этой матрице.
Возвращает разность этой matrix и заданной матрицы.
Вычитает содержимое matrix из этой матрицы.
Оператор присваивания. 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.