Class: QgsMatrix4x4

class qgis.core.QgsMatrix4x4

Bases: sip.wrapper

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.

Added in version 3.34.

QgsMatrix4x4() Initializes identity matrix

QgsMatrix4x4(m11: float, m12: float, m13: float, m14: float, m21: float, m22: float, m23: float, m24: float, m31: float, m32: float, m33: float, m34: float, m41: float, m42: float, m43: float, m44: float) Initializes matrix by setting all values in row-major order

QgsMatrix4x4(QgsMatrix4x4)

Methods

data

Returns matrix data (in column-major order)

isIdentity

Returns whether this matrix is an identity matrix

map

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

setToIdentity

Sets matrix to be identity matrix

translate

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

data(self) List[float]

Returns matrix data (in column-major order)

Return type:

List[float]

isIdentity(self) bool

Returns whether this matrix is an identity matrix

Return type:

bool

map(self, vector: QgsVector3D) QgsVector3D

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

Parameters:

vector (QgsVector3D)

Return type:

QgsVector3D

setToIdentity(self)

Sets matrix to be identity matrix

translate(self, vector: QgsVector3D)

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

Parameters:

vector (QgsVector3D)