Struct qt_gui::QMatrix4X4

source ·
#[repr(C)]
pub struct QMatrix4X4 { /* private fields */ }
Expand description

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

C++ class: QMatrix4x4.

C++ documentation:

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

The QMatrix4x4 class in general is treated as a row-major matrix, in that the constructors and operator() functions take data in row-major format, as is familiar in C-style usage.

Internally the data is stored as column-major format, so as to be optimal for passing to OpenGL functions, which expect column-major data.

When using these functions be aware that they return data in column-major format:

Implementations§

source§

impl QMatrix4X4

source

pub unsafe fn add_assign( &self, other: impl CastInto<Ref<QMatrix4X4>> ) -> Ref<QMatrix4X4>

Adds the contents of other to this matrix.

Calls C++ function: QMatrix4x4& QMatrix4x4::operator+=(const QMatrix4x4& other).

C++ documentation:

Adds the contents of other to this matrix.

source

pub unsafe fn call(&self, row: c_int, column: c_int) -> *const c_float

Returns a constant reference to the element at position (row, column) in this matrix.

Calls C++ function: const float& QMatrix4x4::operator()(int row, int column) const.

C++ documentation:

Returns a constant reference to the element at position (row, column) in this matrix.

See also column() and row().

source

pub unsafe fn call_mut(&self, row: c_int, column: c_int) -> *mut c_float

Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to.

Calls C++ function: float& QMatrix4x4::operator()(int row, int column).

C++ documentation:

Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to.

See also optimize(), setColumn(), and setRow().

source

pub unsafe fn column(&self, index: c_int) -> CppBox<QVector4D>

Returns the elements of column index as a 4D vector.

Calls C++ function: QVector4D QMatrix4x4::column(int index) const.

C++ documentation:

Returns the elements of column index as a 4D vector.

See also setColumn() and row().

source

pub unsafe fn const_data(&self) -> *const c_float

Returns a constant pointer to the raw data of this matrix. This raw data is stored in column-major format.

Calls C++ function: const float* QMatrix4x4::constData() const.

C++ documentation:

Returns a constant pointer to the raw data of this matrix. This raw data is stored in column-major format.

See also data().

source

pub unsafe fn copy_data_to(&self, values: *mut c_float)

Retrieves the 16 items in this matrix and copies them to values in row-major order.

Calls C++ function: void QMatrix4x4::copyDataTo(float* values) const.

C++ documentation:

Retrieves the 16 items in this matrix and copies them to values in row-major order.

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QMatrix4X4>> ) -> Ref<QMatrix4X4>

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

Calls C++ function: QMatrix4x4& QMatrix4x4::operator=(const QMatrix4x4& other).

C++ documentation:

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

The QMatrix4x4 class in general is treated as a row-major matrix, in that the constructors and operator() functions take data in row-major format, as is familiar in C-style usage.

Internally the data is stored as column-major format, so as to be optimal for passing to OpenGL functions, which expect column-major data.

When using these functions be aware that they return data in column-major format:

source

pub unsafe fn data_mut(&self) -> *mut c_float

Returns a pointer to the raw data of this matrix.

Calls C++ function: float* QMatrix4x4::data().

C++ documentation:

Returns a pointer to the raw data of this matrix.

See also constData() and optimize().

source

pub unsafe fn data(&self) -> *const c_float

Returns a constant pointer to the raw data of this matrix. This raw data is stored in column-major format.

Calls C++ function: const float* QMatrix4x4::data() const.

C++ documentation:

Returns a constant pointer to the raw data of this matrix. This raw data is stored in column-major format.

See also constData().

source

pub unsafe fn determinant(&self) -> c_double

Returns the determinant of this matrix.

Calls C++ function: double QMatrix4x4::determinant() const.

C++ documentation:

Returns the determinant of this matrix.

source

pub unsafe fn div_assign(&self, divisor: c_float) -> Ref<QMatrix4X4>

This is an overloaded function.

Calls C++ function: QMatrix4x4& QMatrix4x4::operator/=(float divisor).

C++ documentation:

This is an overloaded function.

Divides all elements of this matrix by divisor.

source

pub unsafe fn fill(&self, value: c_float)

Fills all elements of this matrx with value.

Calls C++ function: void QMatrix4x4::fill(float value).

C++ documentation:

Fills all elements of this matrx with value.

source

pub unsafe fn flip_coordinates(&self)

Flips between right-handed and left-handed coordinate systems by multiplying the y and z co-ordinates by -1. This is normally used to create a left-handed orthographic view without scaling the viewport as ortho() does.

Calls C++ function: void QMatrix4x4::flipCoordinates().

C++ documentation:

Flips between right-handed and left-handed coordinate systems by multiplying the y and z co-ordinates by -1. This is normally used to create a left-handed orthographic view without scaling the viewport as ortho() does.

See also ortho().

Related Non-Members

source

pub unsafe fn frustum( &self, left: c_float, right: c_float, bottom: c_float, top: c_float, near_plane: c_float, far_plane: c_float )

Multiplies this matrix by another that applies a perspective frustum projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes.

Calls C++ function: void QMatrix4x4::frustum(float left, float right, float bottom, float top, float nearPlane, float farPlane).

C++ documentation:

Multiplies this matrix by another that applies a perspective frustum projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes.

See also ortho() and perspective().

source

pub unsafe fn inverted_1a(&self, invertible: *mut bool) -> CppBox<QMatrix4X4>

Returns the inverse of this matrix. Returns the identity if this matrix cannot be inverted; i.e. determinant() is zero. If invertible is not null, then true will be written to that location if the matrix can be inverted; false otherwise.

Calls C++ function: QMatrix4x4 QMatrix4x4::inverted(bool* invertible = …) const.

C++ documentation:

Returns the inverse of this matrix. Returns the identity if this matrix cannot be inverted; i.e. determinant() is zero. If invertible is not null, then true will be written to that location if the matrix can be inverted; false otherwise.

If the matrix is recognized as the identity or an orthonormal matrix, then this function will quickly invert the matrix using optimized routines.

See also determinant() and normalMatrix().

source

pub unsafe fn inverted_0a(&self) -> CppBox<QMatrix4X4>

Returns the inverse of this matrix. Returns the identity if this matrix cannot be inverted; i.e. determinant() is zero. If invertible is not null, then true will be written to that location if the matrix can be inverted; false otherwise.

Calls C++ function: QMatrix4x4 QMatrix4x4::inverted() const.

C++ documentation:

Returns the inverse of this matrix. Returns the identity if this matrix cannot be inverted; i.e. determinant() is zero. If invertible is not null, then true will be written to that location if the matrix can be inverted; false otherwise.

If the matrix is recognized as the identity or an orthonormal matrix, then this function will quickly invert the matrix using optimized routines.

See also determinant() and normalMatrix().

source

pub unsafe fn is_affine(&self) -> bool

Returns true if this matrix is affine matrix; false otherwise.

Calls C++ function: bool QMatrix4x4::isAffine() const.

C++ documentation:

Returns true if this matrix is affine matrix; false otherwise.

An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), e.g. no projective coefficients.

This function was introduced in Qt 5.5.

See also isIdentity().

source

pub unsafe fn is_identity(&self) -> bool

Returns true if this matrix is the identity; false otherwise.

Calls C++ function: bool QMatrix4x4::isIdentity() const.

C++ documentation:

Returns true if this matrix is the identity; false otherwise.

See also setToIdentity().

source

pub unsafe fn look_at( &self, eye: impl CastInto<Ref<QVector3D>>, center: impl CastInto<Ref<QVector3D>>, up: impl CastInto<Ref<QVector3D>> )

Multiplies this matrix by a viewing matrix derived from an eye point. The center value indicates the center of the view that the eye is looking at. The up value indicates which direction should be considered up with respect to the eye.

Calls C++ function: void QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up).

C++ documentation:

Multiplies this matrix by a viewing matrix derived from an eye point. The center value indicates the center of the view that the eye is looking at. The up value indicates which direction should be considered up with respect to the eye.

Note: The up vector must not be parallel to the line of sight from eye to center.

source

pub unsafe fn map_q_point( &self, point: impl CastInto<Ref<QPoint>> ) -> CppBox<QPoint>

Maps point by multiplying this matrix by point.

Calls C++ function: QPoint QMatrix4x4::map(const QPoint& point) const.

C++ documentation:

Maps point by multiplying this matrix by point.

See also mapRect().

source

pub unsafe fn map_q_point_f( &self, point: impl CastInto<Ref<QPointF>> ) -> CppBox<QPointF>

Maps point by multiplying this matrix by point.

Calls C++ function: QPointF QMatrix4x4::map(const QPointF& point) const.

C++ documentation:

Maps point by multiplying this matrix by point.

See also mapRect().

source

pub unsafe fn map_q_vector_3d( &self, point: impl CastInto<Ref<QVector3D>> ) -> CppBox<QVector3D>

Maps point by multiplying this matrix by point.

Calls C++ function: QVector3D QMatrix4x4::map(const QVector3D& point) const.

C++ documentation:

Maps point by multiplying this matrix by point.

See also mapRect() and mapVector().

source

pub unsafe fn map_q_vector_4d( &self, point: impl CastInto<Ref<QVector4D>> ) -> CppBox<QVector4D>

Maps point by multiplying this matrix by point.

Calls C++ function: QVector4D QMatrix4x4::map(const QVector4D& point) const.

C++ documentation:

Maps point by multiplying this matrix by point.

See also mapRect().

source

pub unsafe fn map_rect_q_rect( &self, rect: impl CastInto<Ref<QRect>> ) -> CppBox<QRect>

Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results. The returned rectangle will be an ordinary 2D rectangle with sides parallel to the horizontal and vertical axes.

Calls C++ function: QRect QMatrix4x4::mapRect(const QRect& rect) const.

C++ documentation:

Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results. The returned rectangle will be an ordinary 2D rectangle with sides parallel to the horizontal and vertical axes.

See also map().

source

pub unsafe fn map_rect_q_rect_f( &self, rect: impl CastInto<Ref<QRectF>> ) -> CppBox<QRectF>

Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results. The returned rectangle will be an ordinary 2D rectangle with sides parallel to the horizontal and vertical axes.

Calls C++ function: QRectF QMatrix4x4::mapRect(const QRectF& rect) const.

C++ documentation:

Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results. The returned rectangle will be an ordinary 2D rectangle with sides parallel to the horizontal and vertical axes.

See also map().

source

pub unsafe fn map_vector( &self, vector: impl CastInto<Ref<QVector3D>> ) -> CppBox<QVector3D>

Maps vector by multiplying the top 3x3 portion of this matrix by vector. The translation and projection components of this matrix are ignored.

Calls C++ function: QVector3D QMatrix4x4::mapVector(const QVector3D& vector) const.

C++ documentation:

Maps vector by multiplying the top 3x3 portion of this matrix by vector. The translation and projection components of this matrix are ignored.

See also map().

source

pub unsafe fn mul_assign_q_matrix4_x4( &self, other: impl CastInto<Ref<QMatrix4X4>> ) -> Ref<QMatrix4X4>

Multiplies the contents of other by this matrix.

Calls C++ function: QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& other).

C++ documentation:

Multiplies the contents of other by this matrix.

source

pub unsafe fn mul_assign_float(&self, factor: c_float) -> Ref<QMatrix4X4>

This is an overloaded function.

Calls C++ function: QMatrix4x4& QMatrix4x4::operator*=(float factor).

C++ documentation:

This is an overloaded function.

Multiplies all elements of this matrix by factor.

source

pub unsafe fn neg(&self) -> CppBox<QMatrix4X4>

Calls C++ function: QMatrix4x4 operator-(const QMatrix4x4& matrix).

source

pub unsafe fn new() -> CppBox<QMatrix4X4>

Constructs an identity matrix.

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4().

C++ documentation:

Constructs an identity matrix.

source

pub unsafe fn from_float(values: *const c_float) -> CppBox<QMatrix4X4>

Constructs a matrix from the given 16 floating-point values. The contents of the array values is assumed to be in row-major order.

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4(const float* values).

C++ documentation:

Constructs a matrix from the given 16 floating-point values. The contents of the array values is assumed to be in row-major order.

If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.

See also copyDataTo() and optimize().

source

pub unsafe fn from_16_float( m11: c_float, m12: c_float, m13: c_float, m14: c_float, m21: c_float, m22: c_float, m23: c_float, m24: c_float, m31: c_float, m32: c_float, m33: c_float, m34: c_float, m41: c_float, m42: c_float, m43: c_float, m44: c_float ) -> CppBox<QMatrix4X4>

Constructs a matrix from the 16 elements m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, and m44. The elements are specified in row-major order.

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4(float 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).

C++ documentation:

Constructs a matrix from the 16 elements m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, and m44. The elements are specified in row-major order.

If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.

See also optimize().

source

pub unsafe fn from_float2_int( values: *const c_float, cols: c_int, rows: c_int ) -> CppBox<QMatrix4X4>

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4(const float* values, int cols, int rows).

source

pub unsafe fn from_q_transform( transform: impl CastInto<Ref<QTransform>> ) -> CppBox<QMatrix4X4>

Constructs a 4x4 matrix from the conventional Qt 2D transformation matrix transform.

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4(const QTransform& transform).

C++ documentation:

Constructs a 4x4 matrix from the conventional Qt 2D transformation matrix transform.

If transform has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.

See also toTransform() and optimize().

source

pub unsafe fn from_q_matrix( matrix: impl CastInto<Ref<QMatrix>> ) -> CppBox<QMatrix4X4>

Constructs a 4x4 matrix from a conventional Qt 2D affine transformation matrix.

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4(const QMatrix& matrix).

C++ documentation:

Constructs a 4x4 matrix from a conventional Qt 2D affine transformation matrix.

If matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.

See also toAffine() and optimize().

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QMatrix4X4>> ) -> CppBox<QMatrix4X4>

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

Calls C++ function: [constructor] void QMatrix4x4::QMatrix4x4(const QMatrix4x4& other).

C++ documentation:

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

The QMatrix4x4 class in general is treated as a row-major matrix, in that the constructors and operator() functions take data in row-major format, as is familiar in C-style usage.

Internally the data is stored as column-major format, so as to be optimal for passing to OpenGL functions, which expect column-major data.

When using these functions be aware that they return data in column-major format:

source

pub unsafe fn optimize(&self)

Optimize the usage of this matrix from its current elements.

Calls C++ function: void QMatrix4x4::optimize().

C++ documentation:

Optimize the usage of this matrix from its current elements.

Some operations such as translate(), scale(), and rotate() can be performed more efficiently if the matrix being modified is already known to be the identity, a previous translate(), a previous scale(), etc.

Normally the QMatrix4x4 class keeps track of this special type internally as operations are performed. However, if the matrix is modified directly with {QLoggingCategory::operator()}{operator()()} or data(), then QMatrix4x4 will lose track of the special type and will revert to the safest but least efficient operations thereafter.

By calling optimize() after directly modifying the matrix, the programmer can force QMatrix4x4 to recover the special type if the elements appear to conform to one of the known optimized types.

See also operator()(), data(), and translate().

source

pub unsafe fn ortho_q_rect(&self, rect: impl CastInto<Ref<QRect>>)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::ortho(const QRect& rect).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by rect. The near and far clipping planes will be -1 and 1 respectively.

See also frustum() and perspective().

source

pub unsafe fn ortho_q_rect_f(&self, rect: impl CastInto<Ref<QRectF>>)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::ortho(const QRectF& rect).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by rect. The near and far clipping planes will be -1 and 1 respectively.

See also frustum() and perspective().

source

pub unsafe fn ortho_6_float( &self, left: c_float, right: c_float, bottom: c_float, top: c_float, near_plane: c_float, far_plane: c_float )

Multiplies this matrix by another that applies an orthographic projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes.

Calls C++ function: void QMatrix4x4::ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane).

C++ documentation:

Multiplies this matrix by another that applies an orthographic projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes.

See also frustum() and perspective().

source

pub unsafe fn perspective( &self, vertical_angle: c_float, aspect_ratio: c_float, near_plane: c_float, far_plane: c_float )

Multiplies this matrix by another that applies a perspective projection. The vertical field of view will be verticalAngle degrees within a window with a given aspectRatio that determines the horizontal field of view. The projection will have the specified nearPlane and farPlane clipping planes which are the distances from the viewer to the corresponding planes.

Calls C++ function: void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearPlane, float farPlane).

C++ documentation:

Multiplies this matrix by another that applies a perspective projection. The vertical field of view will be verticalAngle degrees within a window with a given aspectRatio that determines the horizontal field of view. The projection will have the specified nearPlane and farPlane clipping planes which are the distances from the viewer to the corresponding planes.

See also ortho() and frustum().

source

pub unsafe fn rotate_2a( &self, angle: c_float, vector: impl CastInto<Ref<QVector3D>> )

Multiples this matrix by another that rotates coordinates through angle degrees about vector.

Calls C++ function: void QMatrix4x4::rotate(float angle, const QVector3D& vector).

C++ documentation:

Multiples this matrix by another that rotates coordinates through angle degrees about vector.

See also scale() and translate().

source

pub unsafe fn rotate_4a( &self, angle: c_float, x: c_float, y: c_float, z: c_float )

This is an overloaded function.

Calls C++ function: void QMatrix4x4::rotate(float angle, float x, float y, float z = …).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that rotates coordinates through angle degrees about the vector (x, y, z).

See also scale() and translate().

source

pub unsafe fn rotate_1a(&self, quaternion: impl CastInto<Ref<QQuaternion>>)

Multiples this matrix by another that rotates coordinates according to a specified quaternion. The quaternion is assumed to have been normalized.

Calls C++ function: void QMatrix4x4::rotate(const QQuaternion& quaternion).

C++ documentation:

Multiples this matrix by another that rotates coordinates according to a specified quaternion. The quaternion is assumed to have been normalized.

See also scale(), translate(), and QQuaternion.

source

pub unsafe fn rotate_3a(&self, angle: c_float, x: c_float, y: c_float)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::rotate(float angle, float x, float y).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that rotates coordinates through angle degrees about the vector (x, y, z).

See also scale() and translate().

source

pub unsafe fn row(&self, index: c_int) -> CppBox<QVector4D>

Returns the elements of row index as a 4D vector.

Calls C++ function: QVector4D QMatrix4x4::row(int index) const.

C++ documentation:

Returns the elements of row index as a 4D vector.

See also setRow() and column().

source

pub unsafe fn scale_q_vector_3d(&self, vector: impl CastInto<Ref<QVector3D>>)

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

Calls C++ function: void QMatrix4x4::scale(const QVector3D& vector).

C++ documentation:

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

See also translate() and rotate().

source

pub unsafe fn scale_2_float(&self, x: c_float, y: c_float)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::scale(float x, float y).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that scales coordinates by the components x, and y.

See also translate() and rotate().

source

pub unsafe fn scale_3_float(&self, x: c_float, y: c_float, z: c_float)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::scale(float x, float y, float z).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that scales coordinates by the components x, y, and z.

See also translate() and rotate().

source

pub unsafe fn scale_float(&self, factor: c_float)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::scale(float factor).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that scales coordinates by the given factor.

See also translate() and rotate().

source

pub unsafe fn set_column( &self, index: c_int, value: impl CastInto<Ref<QVector4D>> )

Sets the elements of column index to the components of value.

Calls C++ function: void QMatrix4x4::setColumn(int index, const QVector4D& value).

C++ documentation:

Sets the elements of column index to the components of value.

See also column() and setRow().

source

pub unsafe fn set_row(&self, index: c_int, value: impl CastInto<Ref<QVector4D>>)

Sets the elements of row index to the components of value.

Calls C++ function: void QMatrix4x4::setRow(int index, const QVector4D& value).

C++ documentation:

Sets the elements of row index to the components of value.

See also row() and setColumn().

source

pub unsafe fn set_to_identity(&self)

Sets this matrix to the identity.

Calls C++ function: void QMatrix4x4::setToIdentity().

C++ documentation:

Sets this matrix to the identity.

See also isIdentity().

source

pub unsafe fn sub_assign( &self, other: impl CastInto<Ref<QMatrix4X4>> ) -> Ref<QMatrix4X4>

Subtracts the contents of other from this matrix.

Calls C++ function: QMatrix4x4& QMatrix4x4::operator-=(const QMatrix4x4& other).

C++ documentation:

Subtracts the contents of other from this matrix.

source

pub unsafe fn to_affine(&self) -> CppBox<QMatrix>

Returns the conventional Qt 2D affine transformation matrix that corresponds to this matrix. It is assumed that this matrix only contains 2D affine transformation elements.

Calls C++ function: QMatrix QMatrix4x4::toAffine() const.

C++ documentation:

Returns the conventional Qt 2D affine transformation matrix that corresponds to this matrix. It is assumed that this matrix only contains 2D affine transformation elements.

See also toTransform().

source

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>

Returns the matrix as a QVariant.

Calls C++ function: QVariant QMatrix4x4::operator QVariant() const.

C++ documentation:

Returns the matrix as a QVariant.

source

pub unsafe fn to_transform_0a(&self) -> CppBox<QTransform>

Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.

Calls C++ function: QTransform QMatrix4x4::toTransform() const.

C++ documentation:

Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.

The returned QTransform is formed by simply dropping the third row and third column of the QMatrix4x4. This is suitable for implementing orthographic projections where the z co-ordinate should be dropped rather than projected.

See also toAffine().

source

pub unsafe fn to_transform_1a( &self, distance_to_plane: c_float ) -> CppBox<QTransform>

Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.

Calls C++ function: QTransform QMatrix4x4::toTransform(float distanceToPlane) const.

C++ documentation:

Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.

If distanceToPlane is non-zero, it indicates a projection factor to use to adjust for the z co-ordinate. The value of 1024 corresponds to the projection factor used by QTransform::rotate() for the x and y axes.

If distanceToPlane is zero, then the returned QTransform is formed by simply dropping the third row and third column of the QMatrix4x4. This is suitable for implementing orthographic projections where the z co-ordinate should be dropped rather than projected.

See also toAffine().

source

pub unsafe fn translate_1a(&self, vector: impl CastInto<Ref<QVector3D>>)

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

Calls C++ function: void QMatrix4x4::translate(const QVector3D& vector).

C++ documentation:

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

See also scale() and rotate().

source

pub unsafe fn translate_2a(&self, x: c_float, y: c_float)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::translate(float x, float y).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that translates coordinates by the components x, and y.

See also scale() and rotate().

source

pub unsafe fn translate_3a(&self, x: c_float, y: c_float, z: c_float)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::translate(float x, float y, float z).

C++ documentation:

This is an overloaded function.

Multiplies this matrix by another that translates coordinates by the components x, y, and z.

See also scale() and rotate().

source

pub unsafe fn transposed(&self) -> CppBox<QMatrix4X4>

Returns this matrix, transposed about its diagonal.

Calls C++ function: QMatrix4x4 QMatrix4x4::transposed() const.

C++ documentation:

Returns this matrix, transposed about its diagonal.

source

pub unsafe fn viewport_1a(&self, rect: impl CastInto<Ref<QRectF>>)

This is an overloaded function.

Calls C++ function: void QMatrix4x4::viewport(const QRectF& rect).

C++ documentation:

This is an overloaded function.

Sets up viewport transform for viewport bounded by rect and with near and far set to 0 and 1 respectively.

source

pub unsafe fn viewport_6a( &self, left: c_float, bottom: c_float, width: c_float, height: c_float, near_plane: c_float, far_plane: c_float )

Multiplies this matrix by another that performs the scale and bias transformation used by OpenGL to transform from normalized device coordinates (NDC) to viewport (window) coordinates. That is it maps points from the cube ranging over [-1, 1] in each dimension to the viewport with it's near-lower-left corner at (left, bottom, nearPlane) and with size (width, height, farPlane - nearPlane).

Calls C++ function: void QMatrix4x4::viewport(float left, float bottom, float width, float height, float nearPlane = …, float farPlane = …).

C++ documentation:

Multiplies this matrix by another that performs the scale and bias transformation used by OpenGL to transform from normalized device coordinates (NDC) to viewport (window) coordinates. That is it maps points from the cube ranging over [-1, 1] in each dimension to the viewport with it’s near-lower-left corner at (left, bottom, nearPlane) and with size (width, height, farPlane - nearPlane).

This matches the transform used by the fixed function OpenGL viewport transform controlled by the functions glViewport() and glDepthRange().

source

pub unsafe fn viewport_5a( &self, left: c_float, bottom: c_float, width: c_float, height: c_float, near_plane: c_float )

Multiplies this matrix by another that performs the scale and bias transformation used by OpenGL to transform from normalized device coordinates (NDC) to viewport (window) coordinates. That is it maps points from the cube ranging over [-1, 1] in each dimension to the viewport with it's near-lower-left corner at (left, bottom, nearPlane) and with size (width, height, farPlane - nearPlane).

Calls C++ function: void QMatrix4x4::viewport(float left, float bottom, float width, float height, float nearPlane = …).

C++ documentation:

Multiplies this matrix by another that performs the scale and bias transformation used by OpenGL to transform from normalized device coordinates (NDC) to viewport (window) coordinates. That is it maps points from the cube ranging over [-1, 1] in each dimension to the viewport with it’s near-lower-left corner at (left, bottom, nearPlane) and with size (width, height, farPlane - nearPlane).

This matches the transform used by the fixed function OpenGL viewport transform controlled by the functions glViewport() and glDepthRange().

source

pub unsafe fn viewport_4a( &self, left: c_float, bottom: c_float, width: c_float, height: c_float )

Multiplies this matrix by another that performs the scale and bias transformation used by OpenGL to transform from normalized device coordinates (NDC) to viewport (window) coordinates. That is it maps points from the cube ranging over [-1, 1] in each dimension to the viewport with it's near-lower-left corner at (left, bottom, nearPlane) and with size (width, height, farPlane - nearPlane).

Calls C++ function: void QMatrix4x4::viewport(float left, float bottom, float width, float height).

C++ documentation:

Multiplies this matrix by another that performs the scale and bias transformation used by OpenGL to transform from normalized device coordinates (NDC) to viewport (window) coordinates. That is it maps points from the cube ranging over [-1, 1] in each dimension to the viewport with it’s near-lower-left corner at (left, bottom, nearPlane) and with size (width, height, farPlane - nearPlane).

This matches the transform used by the fixed function OpenGL viewport transform controlled by the functions glViewport() and glDepthRange().

Trait Implementations§

source§

impl Add<Ref<QMatrix4X4>> for &QMatrix4X4

source§

fn add(self, m2: Ref<QMatrix4X4>) -> CppBox<QMatrix4X4>

Calls C++ function: QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2).

§

type Output = CppBox<QMatrix4X4>

The resulting type after applying the + operator.
source§

impl CppDeletable for QMatrix4X4

source§

unsafe fn delete(&self)

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

Calls C++ function: [destructor] void QMatrix4x4::~QMatrix4x4().

C++ documentation:

The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.

The QMatrix4x4 class in general is treated as a row-major matrix, in that the constructors and operator() functions take data in row-major format, as is familiar in C-style usage.

Internally the data is stored as column-major format, so as to be optimal for passing to OpenGL functions, which expect column-major data.

When using these functions be aware that they return data in column-major format:

source§

impl Data for QMatrix4X4

source§

unsafe fn data(&self) -> *const c_float

Returns a constant pointer to the raw data of this matrix. This raw data is stored in column-major format.

Calls C++ function: const float* QMatrix4x4::data() const.

C++ documentation:

Returns a constant pointer to the raw data of this matrix. This raw data is stored in column-major format.

See also constData().

§

type Output = *const f32

Return type of data() function.
source§

impl DataMut for QMatrix4X4

source§

unsafe fn data_mut(&self) -> *mut c_float

Returns a pointer to the raw data of this matrix.

Calls C++ function: float* QMatrix4x4::data().

C++ documentation:

Returns a pointer to the raw data of this matrix.

See also constData() and optimize().

§

type Output = *mut f32

Return type of data_mut() function.
source§

impl Div<f32> for &QMatrix4X4

source§

fn div(self, divisor: c_float) -> CppBox<QMatrix4X4>

Calls C++ function: QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor).

§

type Output = CppBox<QMatrix4X4>

The resulting type after applying the / operator.
source§

impl Mul<Ref<QMatrix4X4>> for &QMatrix4X4

source§

fn mul(self, m2: Ref<QMatrix4X4>) -> CppBox<QMatrix4X4>

Calls C++ function: QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2).

§

type Output = CppBox<QMatrix4X4>

The resulting type after applying the * operator.
source§

impl Mul<Ref<QPoint>> for &QMatrix4X4

source§

fn mul(self, point: Ref<QPoint>) -> CppBox<QPoint>

Calls C++ function: QPoint operator*(const QMatrix4x4& matrix, const QPoint& point).

§

type Output = CppBox<QPoint>

The resulting type after applying the * operator.
source§

impl Mul<Ref<QPointF>> for &QMatrix4X4

source§

fn mul(self, point: Ref<QPointF>) -> CppBox<QPointF>

Calls C++ function: QPointF operator*(const QMatrix4x4& matrix, const QPointF& point).

§

type Output = CppBox<QPointF>

The resulting type after applying the * operator.
source§

impl Mul<Ref<QVector3D>> for &QMatrix4X4

source§

fn mul(self, vector: Ref<QVector3D>) -> CppBox<QVector3D>

Calls C++ function: QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector).

§

type Output = CppBox<QVector3D>

The resulting type after applying the * operator.
source§

impl Mul<Ref<QVector4D>> for &QMatrix4X4

source§

fn mul(self, vector: Ref<QVector4D>) -> CppBox<QVector4D>

Calls C++ function: QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector).

§

type Output = CppBox<QVector4D>

The resulting type after applying the * operator.
source§

impl Mul<f32> for &QMatrix4X4

source§

fn mul(self, factor: c_float) -> CppBox<QMatrix4X4>

Calls C++ function: QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor).

§

type Output = CppBox<QMatrix4X4>

The resulting type after applying the * operator.
source§

impl PartialEq<Ref<QMatrix4X4>> for QMatrix4X4

source§

fn eq(&self, other: &Ref<QMatrix4X4>) -> bool

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

Calls C++ function: bool QMatrix4x4::operator==(const QMatrix4x4& other) const.

C++ documentation:

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

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<Ref<QMatrix4X4>> for &QMatrix4X4

source§

fn sub(self, m2: Ref<QMatrix4X4>) -> CppBox<QMatrix4X4>

Calls C++ function: QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2).

§

type Output = CppBox<QMatrix4X4>

The resulting type after applying the - operator.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.