Base::Matrix4D Class Reference

The Matrix4D class. More...

#include <Matrix.h>

Public Member Functions

 Matrix4D (const Matrix4D &rclMtrx)
 Construction. More...
 
 Matrix4D (const Vector3d &rclBase, const Vector3d &rclDir, double fAngle)
 
 Matrix4D (const Vector3f &rclBase, const Vector3f &rclDir, float fAngle)
 Construction with an Axis. More...
 
 Matrix4D (double a11, double a12, double a13, double a14, double a21, double a22, double a23, double a24, double a31, double a32, double a33, double a34, double a41, double a42, double a43, double a44)
 Construction. More...
 
 Matrix4D (float a11, float a12, float a13, float a14, float a21, float a22, float a23, float a24, float a31, float a32, float a33, float a34, float a41, float a42, float a43, float a44)
 Construction. More...
 
 Matrix4D (void)
 Default constructor. More...
 
 ~Matrix4D ()
 Destruction. More...
 
Operators
Matrix4D operator+ (const Matrix4D &rclMtrx) const
 Matrix addition. More...
 
Matrix4Doperator+= (const Matrix4D &rclMtrx)
 
Matrix4D operator- (const Matrix4D &rclMtrx) const
 Matrix subtraction. More...
 
Matrix4Doperator-= (const Matrix4D &rclMtrx)
 
Matrix4Doperator*= (const Matrix4D &rclMtrx)
 Matrix multiplication. More...
 
Matrix4Doperator= (const Matrix4D &rclMtrx)
 Assignment. More...
 
Matrix4D operator* (const Matrix4D &rclMtrx) const
 Matrix multiplication. More...
 
Vector3f operator* (const Vector3f &rclVct) const
 Multiplication matrix with vector. More...
 
Vector3d operator* (const Vector3d &rclVct) const
 
void multVec (const Vector3d &src, Vector3d &dst) const
 
void multVec (const Vector3f &src, Vector3f &dst) const
 
bool operator!= (const Matrix4D &rclMtrx) const
 Comparison. More...
 
bool operator== (const Matrix4D &rclMtrx) const
 Comparison. More...
 
double * operator[] (unsigned short usNdx)
 Index operator. More...
 
const double * operator[] (unsigned short usNdx) const
 Index operator. More...
 
double determinant () const
 Compute the determinant of the matrix. More...
 
std::string analyse (void) const
 Analyse the transformation. More...
 
Matrix4DOuter (const Vector3f &rV1, const Vector3f &rV2)
 Outer product (Dyadic product) More...
 
Matrix4DOuter (const Vector3d &rV1, const Vector3d &rV2)
 
Matrix4DHat (const Vector3f &rV)
 Hat operator (skew symmetric) More...
 
Matrix4DHat (const Vector3d &rV)
 
void getMatrix (double dMtrx[16]) const
 
void setMatrix (const double dMtrx[16])
 
void getGLMatrix (double dMtrx[16]) const
 get the matrix in OpenGL style More...
 
void setGLMatrix (const double dMtrx[16])
 set the matrix in OpenGL style More...
 
unsigned long getMemSpace (void)
 

Manipulation

void setToUnity (void)
 Makes unity matrix. More...
 
void nullify (void)
 Makes a null matrix. More...
 
void move (float x, float y, float z)
 moves the coordinatesystem for the x,y,z value More...
 
void move (double x, double y, double z)
 
void move (const Vector3f &rclVct)
 moves the coordinatesystem for the vector More...
 
void move (const Vector3d &rclVct)
 
void scale (float x, float y, float z)
 scale for the vector More...
 
void scale (double x, double y, double z)
 
void scale (const Vector3f &rclVct)
 scale for the x,y,z value More...
 
void scale (const Vector3d &rclVct)
 
int hasScale (double tol=0.0) const
 Check for scaling factor, 0: not scale, 1: uniform scale, or else -1. More...
 
void rotX (double fAngle)
 Rotate around the X axis (in transformed space) for the given value in radians. More...
 
void rotY (double fAngle)
 Rotate around the Y axis (in transformed space) for the given value in radians. More...
 
void rotZ (double fAngle)
 Rotate around the Z axis (in transformed space) for the given value in radians. More...
 
void rotLine (const Vector3f &rclVct, float fAngle)
 Rotate around an arbitrary axis passing the origin in radians. More...
 
void rotLine (const Vector3d &rclVct, double fAngle)
 Rotate around an arbitrary axis passing the origin in radians. More...
 
void rotLine (const Vector3f &rclBase, const Vector3f &rclDir, float fAngle)
 Rotate around an arbitrary axis that needn't necessarily pass the origin in radians. More...
 
void rotLine (const Vector3d &rclBase, const Vector3d &rclDir, double fAngle)
 Rotate around an arbitrary axis that needn't necessarily pass the origin in radians. More...
 
bool toAxisAngle (Vector3f &rclBase, Vector3f &rclDir, float &fAngle, float &fTranslation) const
 Extract the rotation axis and angle. Therefore the 3x3 submatrix must be orthogonal. More...
 
bool toAxisAngle (Vector3d &rclBase, Vector3d &rclDir, double &fAngle, double &fTranslation) const
 
void transform (const Vector3f &rclVct, const Matrix4D &rclMtrx)
 transform (move,scale,rotate) around a point More...
 
void transform (const Vector3d &rclVct, const Matrix4D &rclMtrx)
 
void inverse (void)
 Matrix is expected to have a 3x3 rotation submatrix. More...
 
void inverseOrthogonal (void)
 Matrix is expected to have a 3x3 rotation submatrix. More...
 
void inverseGauss (void)
 Arbitrary, non-singular matrix. More...
 
void transpose (void)
 
void Print (void) const
 
std::string toString (void) const
 write the 16 double of the matrix into a string More...
 
void fromString (const std::string &str)
 read the 16 double of the matrix from a string More...
 

Detailed Description

The Matrix4D class.

Constructor & Destructor Documentation

◆ Matrix4D() [1/6]

Matrix4D::Matrix4D ( void  )

Default constructor.

Initialises to an identity matrix

References setToUnity().

Referenced by getMemSpace().

◆ Matrix4D() [2/6]

Matrix4D::Matrix4D ( float  a11,
float  a12,
float  a13,
float  a14,
float  a21,
float  a22,
float  a23,
float  a24,
float  a31,
float  a32,
float  a33,
float  a34,
float  a41,
float  a42,
float  a43,
float  a44 
)

Construction.

◆ Matrix4D() [3/6]

Matrix4D::Matrix4D ( double  a11,
double  a12,
double  a13,
double  a14,
double  a21,
double  a22,
double  a23,
double  a24,
double  a31,
double  a32,
double  a33,
double  a34,
double  a41,
double  a42,
double  a43,
double  a44 
)

Construction.

◆ Matrix4D() [4/6]

Matrix4D::Matrix4D ( const Matrix4D rclMtrx)

Construction.

◆ Matrix4D() [5/6]

Matrix4D::Matrix4D ( const Vector3f rclBase,
const Vector3f rclDir,
float  fAngle 
)

Construction with an Axis.

References rotLine(), and setToUnity().

◆ Matrix4D() [6/6]

Matrix4D::Matrix4D ( const Vector3d rclBase,
const Vector3d rclDir,
double  fAngle 
)

References rotLine(), and setToUnity().

◆ ~Matrix4D()

Base::Matrix4D::~Matrix4D ( )

Destruction.

Member Function Documentation

◆ analyse()

std::string Matrix4D::analyse ( void  ) const

Analyse the transformation.

References determinant(), and transpose().

Referenced by Base::MatrixPy::analyze().

◆ determinant()

double Matrix4D::determinant ( ) const

Compute the determinant of the matrix.

Referenced by analyse().

◆ fromString()

void Matrix4D::fromString ( const std::string &  str)

read the 16 double of the matrix from a string

Referenced by Points::PropertyPointKernel::Restore().

◆ getGLMatrix()

void Matrix4D::getGLMatrix ( double  dMtrx[16]) const

◆ getMatrix()

void Matrix4D::getMatrix ( double  dMtrx[16]) const

◆ getMemSpace()

unsigned long Matrix4D::getMemSpace ( void  )

References Matrix4D().

◆ hasScale()

int Matrix4D::hasScale ( double  tol = 0.0) const

Check for scaling factor, 0: not scale, 1: uniform scale, or else -1.

References Base::Vector3< _Precision >::Sqr().

◆ Hat() [1/2]

◆ Hat() [2/2]

Matrix4D & Matrix4D::Hat ( const Vector3f rV)

Hat operator (skew symmetric)

References setToUnity().

◆ inverse()

◆ inverseGauss()

void Matrix4D::inverseGauss ( void  )

Arbitrary, non-singular matrix.

References getGLMatrix(), and setGLMatrix().

Referenced by Gui::TreeWidget::dropEvent(), Base::MatrixPy::invert(), and PartDesign::SubShapeBinder::update().

◆ inverseOrthogonal()

void Matrix4D::inverseOrthogonal ( void  )

Matrix is expected to have a 3x3 rotation submatrix.

References operator*(), and transpose().

Referenced by Mesh::MeshPy::cut(), and Mesh::MeshPy::trim().

◆ move() [1/4]

◆ move() [2/4]

void Matrix4D::move ( const Vector3f rclVct)

moves the coordinatesystem for the vector

References move().

Referenced by draftguitools.gui_circulararray.CircularArray::Activated(), and draftguitools.gui_polararray.PolarArray::Activated().

◆ move() [3/4]

void Base::Matrix4D::move ( double  x,
double  y,
double  z 
)

◆ move() [4/4]

◆ multVec() [1/2]

◆ multVec() [2/2]

void Base::Matrix4D::multVec ( const Vector3f src,
Vector3f dst 
) const

◆ nullify()

void Matrix4D::nullify ( void  )

Makes a null matrix.

◆ operator!=()

bool Base::Matrix4D::operator!= ( const Matrix4D rclMtrx) const

Comparison.

◆ operator*() [1/3]

Matrix4D Base::Matrix4D::operator* ( const Matrix4D rclMtrx) const

Matrix multiplication.

Referenced by inverseOrthogonal().

◆ operator*() [2/3]

Vector3d Base::Matrix4D::operator* ( const Vector3d rclVct) const

◆ operator*() [3/3]

Vector3f Base::Matrix4D::operator* ( const Vector3f rclVct) const

Multiplication matrix with vector.

◆ operator*=()

Matrix4D & Base::Matrix4D::operator*= ( const Matrix4D rclMtrx)

Matrix multiplication.

◆ operator+()

Matrix4D Base::Matrix4D::operator+ ( const Matrix4D rclMtrx) const

Matrix addition.

◆ operator+=()

Matrix4D & Base::Matrix4D::operator+= ( const Matrix4D rclMtrx)

◆ operator-()

Matrix4D Base::Matrix4D::operator- ( const Matrix4D rclMtrx) const

Matrix subtraction.

◆ operator-=()

Matrix4D & Base::Matrix4D::operator-= ( const Matrix4D rclMtrx)

◆ operator=()

Matrix4D & Base::Matrix4D::operator= ( const Matrix4D rclMtrx)

Assignment.

◆ operator==()

bool Base::Matrix4D::operator== ( const Matrix4D rclMtrx) const

Comparison.

◆ operator[]() [1/2]

double * Base::Matrix4D::operator[] ( unsigned short  usNdx)

Index operator.

◆ operator[]() [2/2]

const double * Base::Matrix4D::operator[] ( unsigned short  usNdx) const

Index operator.

◆ Outer() [1/2]

◆ Outer() [2/2]

Matrix4D & Matrix4D::Outer ( const Vector3f rV1,
const Vector3f rV2 
)

Outer product (Dyadic product)

References setToUnity().

◆ Print()

void Matrix4D::Print ( void  ) const

◆ rotLine() [1/4]

void Matrix4D::rotLine ( const Vector3d rclBase,
const Vector3d rclDir,
double  fAngle 
)

Rotate around an arbitrary axis that needn't necessarily pass the origin in radians.

References rotLine(), and transform().

◆ rotLine() [2/4]

void Matrix4D::rotLine ( const Vector3d rclVct,
double  fAngle 
)

Rotate around an arbitrary axis passing the origin in radians.

References Base::Vector3< _Precision >::Normalize(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ rotLine() [3/4]

void Matrix4D::rotLine ( const Vector3f rclBase,
const Vector3f rclDir,
float  fAngle 
)

Rotate around an arbitrary axis that needn't necessarily pass the origin in radians.

References rotLine().

◆ rotLine() [4/4]

void Matrix4D::rotLine ( const Vector3f rclVct,
float  fAngle 
)

Rotate around an arbitrary axis passing the origin in radians.

Referenced by Matrix4D(), rotLine(), and TechDraw::DrawUtil::vecRotate().

◆ rotX()

void Matrix4D::rotX ( double  fAngle)

Rotate around the X axis (in transformed space) for the given value in radians.

Referenced by Mesh::MeshPy::rotate(), and Base::MatrixPy::rotateX().

◆ rotY()

void Matrix4D::rotY ( double  fAngle)

Rotate around the Y axis (in transformed space) for the given value in radians.

Referenced by Base::MatrixPy::rotateY().

◆ rotZ()

void Matrix4D::rotZ ( double  fAngle)

◆ scale() [1/4]

◆ scale() [2/4]

void Matrix4D::scale ( const Vector3f rclVct)

scale for the x,y,z value

References scale().

◆ scale() [3/4]

void Base::Matrix4D::scale ( double  x,
double  y,
double  z 
)

◆ scale() [4/4]

◆ setGLMatrix()

void Matrix4D::setGLMatrix ( const double  dMtrx[16])

set the matrix in OpenGL style

Referenced by inverseGauss().

◆ setMatrix()

void Matrix4D::setMatrix ( const double  dMtrx[16])

Referenced by Base::MatrixPy::setA().

◆ setToUnity()

◆ toAxisAngle() [1/2]

bool Matrix4D::toAxisAngle ( Vector3d rclBase,
Vector3d rclDir,
double &  fAngle,
double &  fTranslation 
) const

◆ toAxisAngle() [2/2]

bool Matrix4D::toAxisAngle ( Vector3f rclBase,
Vector3f rclDir,
float &  rfAngle,
float &  fTranslation 
) const

Extract the rotation axis and angle. Therefore the 3x3 submatrix must be orthogonal.

If this matrix describes a rotation around an arbitrary axis with a translation (in axis direction) then the base point of the axis, its direction, the rotation angle and the translation part get calculated.

In this case the return value is set to true, if this matrix doesn't describe a rotation false is returned.

The translation vector can be calculated with fTranslation * rclDir, whereas the length of rclDir is normalized to 1.

Note: In case the fTranslation part is zero then passing rclBase, rclDir and rfAngle to a new matrix object creates an identical matrix.

◆ toString()

std::string Matrix4D::toString ( void  ) const

write the 16 double of the matrix into a string

◆ transform() [1/2]

void Matrix4D::transform ( const Vector3d rclVct,
const Matrix4D rclMtrx 
)

References move().

◆ transform() [2/2]

void Matrix4D::transform ( const Vector3f rclVct,
const Matrix4D rclMtrx 
)

transform (move,scale,rotate) around a point

References move().

Referenced by rotLine(), and Base::MatrixPy::transform().

◆ transpose()

void Matrix4D::transpose ( void  )

The documentation for this class was generated from the following files:
  • src/Base/Matrix.h
  • src/Base/Matrix.cpp