Base::Matrix4D Class Reference

The Matrix4D class. More...

#include <Matrix.h>

Public Member Functions

 Matrix4D ()
 Default constructor. More...
 
 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 ()
 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
 
Matrix4D operator* (double) const
 
Matrix4Doperator*= (double)
 
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...
 
Vector3d getRow (unsigned short usNdx) const
 Get vector of row. More...
 
Vector3d getCol (unsigned short usNdx) const
 Get vector of column. More...
 
Vector3d trace () const
 Get vector of trace. More...
 
void setRow (unsigned short usNdx, const Vector3d &)
 Set row to vector. More...
 
void setCol (unsigned short usNdx, const Vector3d &)
 Set column to vector. More...
 
void setTrace (const Vector3d &)
 Set trace to vector. More...
 
double determinant () const
 Compute the determinant of the matrix. More...
 
double determinant3 () const
 Compute the determinant of the 3x3 sub-matrix. More...
 
std::string analyse () 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 ()
 

Manipulation

void setToUnity ()
 Makes unity matrix. More...
 
bool isUnity () const
 Checks if this is the unit matrix. More...
 
void nullify ()
 Makes a null matrix. More...
 
bool isNull () const
 Checks if this is the 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)
 
void scale (float scalexyz)
 uniform scale More...
 
void scale (double scalexyz)
 
ScaleType hasScale (double tol=0.0) const
 Check for scaling factor. 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 ()
 Matrix is expected to have a 3x3 rotation submatrix. More...
 
void inverseOrthogonal ()
 Matrix is expected to have a 3x3 rotation submatrix. More...
 
void inverseGauss ()
 Arbitrary, non-singular matrix. More...
 
void transpose ()
 
void Print () const
 
std::string toString () 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 ( )

Default constructor.

Initialises to an identity matrix

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().

◆ Matrix4D() [6/6]

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

References rotLine().

◆ ~Matrix4D()

Base::Matrix4D::~Matrix4D ( )

Destruction.

Member Function Documentation

◆ analyse()

std::string Matrix4D::analyse ( ) const

Analyse the transformation.

References determinant(), and transpose().

◆ determinant()

double Matrix4D::determinant ( ) const

Compute the determinant of the matrix.

Referenced by analyse().

◆ determinant3()

double Matrix4D::determinant3 ( ) const

Compute the determinant of the 3x3 sub-matrix.

Referenced by hasScale().

◆ fromString()

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

read the 16 double of the matrix from a string

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

◆ getCol()

Vector3d Base::Matrix4D::getCol ( unsigned short  usNdx) const

Get vector of column.

◆ getGLMatrix()

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

◆ getMatrix()

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

◆ getMemSpace()

unsigned long Matrix4D::getMemSpace ( )

References Matrix4D().

◆ getRow()

Vector3d Base::Matrix4D::getRow ( unsigned short  usNdx) const

Get vector of row.

◆ hasScale()

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

◆ Hat() [1/2]

◆ Hat() [2/2]

Matrix4D & Matrix4D::Hat ( const Vector3f rV)

Hat operator (skew symmetric)

References Hat(), and setToUnity().

Referenced by Hat().

◆ inverse()

◆ inverseGauss()

void Matrix4D::inverseGauss ( )

Arbitrary, non-singular matrix.

References getGLMatrix(), and setGLMatrix().

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

◆ inverseOrthogonal()

void Matrix4D::inverseOrthogonal ( )

Matrix is expected to have a 3x3 rotation submatrix.

References operator*(), and transpose().

◆ isNull()

bool Matrix4D::isNull ( ) const

Checks if this is the null matrix.

◆ isUnity()

bool Matrix4D::isUnity ( ) const

Checks if this is the unit matrix.

◆ 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 ( )

Makes a null matrix.

◆ operator!=()

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

Comparison.

◆ operator*() [1/4]

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

Matrix multiplication.

Referenced by inverseOrthogonal().

◆ operator*() [2/4]

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

◆ operator*() [3/4]

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

◆ operator*() [4/4]

Matrix4D Base::Matrix4D::operator* ( double  scalar) const

◆ operator*=() [1/2]

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

Matrix multiplication.

◆ operator*=() [2/2]

Matrix4D & Base::Matrix4D::operator*= ( double  scalar)

◆ 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.

References Base::float_traits< double >::epsilon().

◆ 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 Outer(), and setToUnity().

Referenced by Outer().

◆ Print()

void Matrix4D::Print ( ) 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.

References rotLine().

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.

◆ rotY()

void Matrix4D::rotY ( double  fAngle)

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

◆ rotZ()

void Matrix4D::rotZ ( double  fAngle)

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

Referenced by Part::Prism::execute(), Part::RegularPolygon::execute(), PartDesign::Prism::execute(), DraftUtils::DraftDxfRead::OnReadInsert(), and Import::ImpExpDxfRead::OnReadInsert().

◆ scale() [1/6]

◆ scale() [2/6]

◆ scale() [3/6]

◆ scale() [4/6]

◆ scale() [5/6]

◆ scale() [6/6]

◆ setCol()

void Base::Matrix4D::setCol ( unsigned short  usNdx,
const Vector3d v 
)

Set column to vector.

◆ 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])

◆ setRow()

void Base::Matrix4D::setRow ( unsigned short  usNdx,
const Vector3d v 
)

Set row to vector.

◆ setToUnity()

◆ setTrace()

void Base::Matrix4D::setTrace ( const Vector3d v)

Set trace to vector.

◆ 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.

References toAxisAngle().

Referenced by toAxisAngle().

◆ toString()

std::string Matrix4D::toString ( ) const

write the 16 double of the matrix into a string

◆ trace()

Vector3d Base::Matrix4D::trace ( ) const

Get vector of trace.

◆ transform() [1/2]

◆ transform() [2/2]

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

◆ transpose()

void Matrix4D::transpose ( )

Referenced by analyse(), and inverseOrthogonal().


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