OMC::Matrix Class Reference

Detailed Description

Provides a 3D transformation matrix (4x4).

Public Member Functions

 Matrix (const QVariant &var)
 
 Matrix (const QVariant &normal, const QVariant &origin)
 
OMC::Matrixmatrix_rotation () const
 Returns rotation component of this matrix (3x3 block).
 
virtual void reset ()
 Resets the matrix to the identity matrix.
 
virtual void normalize ()
 Normalizes the matrix.
 
virtual QVariant apply (const QVariant &variant)
 Applies the matrix to the incoming variant type – returning the result.
 
void multiply (const OMC::Matrix *matrix)
 Compounds this matrix with m, same as = (*this) * m. The matrix object is modified in place.
 
void translate (const OMC::Vector3d *vector)
 Translates the local coordinate system represented by this tranformation matrix by the given vector. The matrix object is modified in place.
 
virtual void translate (double deltaX=0.0, double deltaY=0.0, double deltaZ=0.0)
 Translates the local coordinate system represented by this tranformation matrix by the given vector. The matrix object is modified in place.
 
virtual void scale (double scaleX=1.0, double scaleY=1.0, double scaleZ=1.0)
 Scales the local coordinate system represented by this tranformation matrix by the given factors. The matrix object is modified in place.
 
void rotate_radians (double rads, const OMC::Vector3d *vector)
 Rotates the local coordinate system represented by this tranformation matrix by the given angle (expressed in radian) around the given vector. The matrix object is modified in place.
 
void rotate_degrees (double degs, const OMC::Vector3d *vector)
 Rotates the local coordinate system represented by this tranformation matrix by the given angle (expressed in degree) around the given vector. The matrix object is modified in place.
 
virtual void skew (double skew)
 Skews the local coordinate system represented by this tranformation matrix by the given angle (expressed in degree). The matrix object is modified in place.
 
void orthogonal_project (double left, double right, double bottom, double top, double zNear, double zFar)
 Applies an orthogonal projection to the local coordinate system represented by this tranformation matrix. The matrix object is modified in place.
 
void perspective_project (double left, double right, double bottom, double top, double zNear, double zFar)
 Applies a perspective projection to the local coordinate system represented by this tranformation matrix. The matrix object is modified in place.
 
void perspective_project (double verticalFieldOfViewInDegrees, double widthOverHeightAspectRatio, double zNear, double zFar)
 Applies a perspective projection to the local coordinate system represented by this tranformation matrix. The matrix object is modified in place.
 
void look_at (const OMC::Point3d *eye, const OMC::Point3d *center, const OMC::Vector3d *upDirection)
 Replaces this by a lookAt matrix. The matrix object is modified in place.
 
QList< QVariant > extract_parameters_2d (bool sxPos, bool syPos, OMC::Point2d *pivot) const
 Extracts the individual transformation parameters from the matrix. More...
 
QList< QVariant > extract_parameters_3d (OMC::Point3d *pivot) const
 Extract 3d matrix parameters using 3d pivot value. More...
 
virtual void inverse ()
 Inverse the current matrix.
 
OMC::Matrixget_inverse ()
 Provides the inverted matrix and leaves the current one unaffected. More...
 
virtual void transpose ()
 Transposes this matrix.
 
virtual void print (const QString &string)
 Prints the matrix' details to the application's stdout.
 

Public Attributes

bool has_nan
 True if the matrix has a NaN in any value.
 
bool has_infinity
 True if the matrix has infinity in any value.
 
OMC::Vector3daxis_x
 Get and set the x axis of the matrix.
 
OMC::Vector3daxis_y
 Get and set the y axis of the matrix.
 
OMC::Vector3daxis_z
 Get and set the z axis of the matrix.
 
OMC::Point3dorigin
 Get and set the origin of the matrix.
 
bool identity
 Get and set whether the matrix is an identity matrix. Setting to true will reset the matrix.
 
bool singular
 True if the matrix is singular.
 
double truck_factor
 The truck factor is a compensation factor due to the zooming of the camera. It is inherent to the transformations of a matrix.
 
double scale_factor
 The scale-factor inherent in the matrix.
 
bool rotation_exists
 True if this matrix has a rotation or shear component (2D or 3D). False otherwise, in which case the matrix can only have scaling, perspective and translation components.
 
bool constant_z
 True if transforming a constant Z plane yields another constant Z plane.
 
bool transform_2d
 True if this matrix can be converted to a 3x2 matrix representing a 2d transformation, false otherwise.
 
bool perspective
 True if any of the matrix's three projection terms are non-zero.
 

Member Function Documentation

◆ extract_parameters_2d()

QList<QVariant> OMC::Matrix::extract_parameters_2d ( bool  sxPos,
bool  syPos,
OMC::Point2d pivot 
) const

Extracts the individual transformation parameters from the matrix.

Parameters
sxPos- Resolve x axis scale sign ambiguity.
syPos- Resolve y axis scale sign ambiguity.
pivot- Pivot position.

The return is provided in a list of individual paramaters in the order: [ OMC::Point3d - Translation, OMC::Vector2d - Scale, double - angle (around z-axis) in degrees double - skew ]

◆ extract_parameters_3d()

QList<QVariant> OMC::Matrix::extract_parameters_3d ( OMC::Point3d pivot) const

Extract 3d matrix parameters using 3d pivot value.

Parameters
pivot- Pivot position.

The return is provided in a list of individual paramaters in the order: [ OMC::Point3d - Translation, OMC::Vector3d - Scale, OMC::Vector3d - angle around each axis in degrees

◆ get_inverse()

OMC::Matrix* OMC::Matrix::get_inverse ( )

Provides the inverted matrix and leaves the current one unaffected.

Returns
The inverted Matrix.
Inheritance diagram for OMC::Matrix:
Collaboration diagram for OMC::Matrix: