QGIS API Documentation 3.41.0-Master (3291e9ff48b)
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
QgsMatrix4x4 Class Reference

A simple 4x4 matrix implementation useful for transformation in 3D space. More...

#include <qgsmatrix4x4.h>

Public Member Functions

 QgsMatrix4x4 ()
 Initializes identity matrix.
 
 QgsMatrix4x4 (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44)
 Initializes matrix by setting all values in row-major order.
 
const double * constData () const
 Returns pointer to the matrix data (stored in column-major order)
 
double * data ()
 Returns pointer to the matrix data (stored in column-major order)
 
QList< double > dataList () const
 Returns matrix data (in column-major order)
 
bool isIdentity () const
 Returns whether this matrix is an identity matrix.
 
QgsVector3D map (const QgsVector3D &vector) const
 Matrix-vector multiplication (vector is converted to homogeneous coordinates [X,Y,Z,1] and back)
 
bool operator!= (const QgsMatrix4x4 &other) const
 
bool operator== (const QgsMatrix4x4 &other) const
 
void setToIdentity ()
 Sets matrix to be identity matrix.
 
void translate (const QgsVector3D &vector)
 Multiplies this matrix by another that translates coordinates by the components of a vector.
 

Friends

CORE_EXPORT QgsMatrix4x4 operator* (const QgsMatrix4x4 &m1, const QgsMatrix4x4 &m2)
 Matrix-vector multiplication (vector is converted to homogeneous coordinates [X,Y,Z,1] and back)
 
CORE_EXPORT QgsVector3D operator* (const QgsMatrix4x4 &matrix, const QgsVector3D &vector)
 Matrix-matrix multiplication (useful to concatenate transforms)
 

Detailed Description

A simple 4x4 matrix implementation useful for transformation in 3D space.

It is similar to QMatrix4x4, but working with double precision values. Most of the time, doing transform using QMatrix4x4 is fine, however QgsMatrix4x4 is useful in situations where single precision floats are not enough. For example, when using transform matrix where translation component has values in order of millions.

Warning
Non-stable API, exposed to Python for unit testing only.
Since
QGIS 3.34

Definition at line 39 of file qgsmatrix4x4.h.

Constructor & Destructor Documentation

◆ QgsMatrix4x4() [1/2]

QgsMatrix4x4::QgsMatrix4x4 ( )
inline

Initializes identity matrix.

Definition at line 43 of file qgsmatrix4x4.h.

◆ QgsMatrix4x4() [2/2]

QgsMatrix4x4::QgsMatrix4x4 ( double  m11,
double  m12,
double  m13,
double  m14,
double  m21,
double  m22,
double  m23,
double  m24,
double  m31,
double  m32,
double  m33,
double  m34,
double  m41,
double  m42,
double  m43,
double  m44 
)

Initializes matrix by setting all values in row-major order.

Definition at line 21 of file qgsmatrix4x4.cpp.

Member Function Documentation

◆ constData()

const double * QgsMatrix4x4::constData ( ) const
inline

Returns pointer to the matrix data (stored in column-major order)

Definition at line 68 of file qgsmatrix4x4.h.

◆ data()

double * QgsMatrix4x4::data ( )
inline

Returns pointer to the matrix data (stored in column-major order)

Definition at line 70 of file qgsmatrix4x4.h.

◆ dataList()

QList< double > QgsMatrix4x4::dataList ( ) const

Returns matrix data (in column-major order)

Definition at line 40 of file qgsmatrix4x4.cpp.

◆ isIdentity()

bool QgsMatrix4x4::isIdentity ( ) const

Returns whether this matrix is an identity matrix.

Definition at line 77 of file qgsmatrix4x4.cpp.

◆ map()

QgsVector3D QgsMatrix4x4::map ( const QgsVector3D vector) const
inline

Matrix-vector multiplication (vector is converted to homogeneous coordinates [X,Y,Z,1] and back)

Definition at line 80 of file qgsmatrix4x4.h.

◆ operator!=()

bool QgsMatrix4x4::operator!= ( const QgsMatrix4x4 other) const
inline

Definition at line 62 of file qgsmatrix4x4.h.

◆ operator==()

bool QgsMatrix4x4::operator== ( const QgsMatrix4x4 other) const
inline

Definition at line 50 of file qgsmatrix4x4.h.

◆ setToIdentity()

void QgsMatrix4x4::setToIdentity ( )

Sets matrix to be identity matrix.

Definition at line 92 of file qgsmatrix4x4.cpp.

◆ translate()

void QgsMatrix4x4::translate ( const QgsVector3D vector)

Multiplies this matrix by another that translates coordinates by the components of a vector.

Definition at line 32 of file qgsmatrix4x4.cpp.

Friends And Related Symbol Documentation

◆ operator* [1/2]

CORE_EXPORT QgsMatrix4x4 operator* ( const QgsMatrix4x4 m1,
const QgsMatrix4x4 m2 
)
friend

Matrix-vector multiplication (vector is converted to homogeneous coordinates [X,Y,Z,1] and back)

Definition at line 113 of file qgsmatrix4x4.cpp.

◆ operator* [2/2]

CORE_EXPORT QgsVector3D operator* ( const QgsMatrix4x4 matrix,
const QgsVector3D vector 
)
friend

Matrix-matrix multiplication (useful to concatenate transforms)

Definition at line 51 of file qgsmatrix4x4.cpp.


The documentation for this class was generated from the following files: