#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... | |
Matrix4D & | operator+= (const Matrix4D &rclMtrx) |
Matrix4D | operator- (const Matrix4D &rclMtrx) const |
Matrix subtraction. More... | |
Matrix4D & | operator-= (const Matrix4D &rclMtrx) |
Matrix4D & | operator*= (const Matrix4D &rclMtrx) |
Matrix multiplication. More... | |
Matrix4D & | operator= (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 |
Matrix4D & | operator*= (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... | |
Matrix4D & | Outer (const Vector3f &rV1, const Vector3f &rV2) |
Outer product (Dyadic product) More... | |
Matrix4D & | Outer (const Vector3d &rV1, const Vector3d &rV2) |
Matrix4D & | Hat (const Vector3f &rV) |
Hat operator (skew symmetric) More... | |
Matrix4D & | Hat (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... | |
The Matrix4D class.
Matrix4D::Matrix4D | ( | ) |
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::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::Matrix4D | ( | const Matrix4D & | rclMtrx | ) |
Construction.
References rotLine().
Base::Matrix4D::~Matrix4D | ( | ) |
Destruction.
std::string Matrix4D::analyse | ( | ) | const |
Analyse the transformation.
References determinant(), and transpose().
double Matrix4D::determinant | ( | ) | const |
Compute the determinant of the matrix.
Referenced by analyse().
double Matrix4D::determinant3 | ( | ) | const |
Compute the determinant of the 3x3 sub-matrix.
Referenced by hasScale().
void Matrix4D::fromString | ( | const std::string & | str | ) |
read the 16 double of the matrix from a string
Referenced by Points::PropertyPointKernel::Restore().
Vector3d Base::Matrix4D::getCol | ( | unsigned short | usNdx | ) | const |
Get vector of column.
void Matrix4D::getGLMatrix | ( | double | dMtrx[16] | ) | const |
get the matrix in OpenGL style
Referenced by Gui::ViewProvider::convert(), inverseGauss(), Gui::View3DInventorViewer::setEditingTransform(), Gui::LinkView::setTransform(), and Gui::ViewProvider::setTransformation().
void Matrix4D::getMatrix | ( | double | dMtrx[16] | ) | const |
unsigned long Matrix4D::getMemSpace | ( | ) |
References Matrix4D().
Vector3d Base::Matrix4D::getRow | ( | unsigned short | usNdx | ) | const |
Get vector of row.
ScaleType Matrix4D::hasScale | ( | double | tol = 0.0 | ) | const |
Check for scaling factor.
References determinant3(), Base::NonUniformLeft, Base::NonUniformRight, Base::NoScaling, Base::Other, Base::Vector3< _Precision >::Sqr(), and Base::Uniform.
void Matrix4D::inverse | ( | ) |
Matrix is expected to have a 3x3 rotation submatrix.
Referenced by PartGui::evaluateAngularPreSelection(), PartGui::TaskMeasureAngular::onSelectionChanged(), PathGui::PathSelectionObserver::onSelectionChanged(), Gui::ViewProviderDragger::setEditViewer(), and Data::ComplexGeoData::transformToInside().
void Matrix4D::inverseGauss | ( | ) |
Arbitrary, non-singular matrix.
References getGLMatrix(), and setGLMatrix().
Referenced by Gui::TreeWidget::dropEvent(), and PartDesign::SubShapeBinder::update().
void Matrix4D::inverseOrthogonal | ( | ) |
Matrix is expected to have a 3x3 rotation submatrix.
References operator*(), and transpose().
bool Matrix4D::isNull | ( | ) | const |
Checks if this is the null matrix.
bool Matrix4D::isUnity | ( | ) | const |
Checks if this is the unit matrix.
void Matrix4D::move | ( | const Vector3d & | rclVct | ) |
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().
void Base::Matrix4D::move | ( | double | x, |
double | y, | ||
double | z | ||
) |
void Base::Matrix4D::move | ( | float | x, |
float | y, | ||
float | z | ||
) |
moves the coordinatesystem for the x,y,z value
References draftfunctions.move::move().
Referenced by draftguitools.gui_circulararray.CircularArray::Activated(), draftguitools.gui_polararray.PolarArray::Activated(), Data::ComplexGeoData::applyTranslation(), Base::ViewProjMatrix::getProjectionMatrix(), move(), DraftUtils::DraftDxfRead::OnReadInsert(), Import::ImpExpDxfRead::OnReadInsert(), and transform().
void Matrix4D::nullify | ( | ) |
Makes a null matrix.
Matrix multiplication.
Referenced by inverseOrthogonal().
Multiplication matrix with vector.
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Matrix4D Base::Matrix4D::operator* | ( | double | scalar | ) | const |
Matrix4D & Base::Matrix4D::operator*= | ( | double | scalar | ) |
Comparison.
References Base::float_traits< double >::epsilon().
double * Base::Matrix4D::operator[] | ( | unsigned short | usNdx | ) |
Index operator.
const double * Base::Matrix4D::operator[] | ( | unsigned short | usNdx | ) | const |
Index operator.
void Matrix4D::Print | ( | ) | const |
Rotate around an arbitrary axis that needn't necessarily pass the origin in radians.
References rotLine(), and transform().
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.
Rotate around an arbitrary axis that needn't necessarily pass the origin in radians.
References rotLine().
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().
void Matrix4D::rotX | ( | double | fAngle | ) |
Rotate around the X axis (in transformed space) for the given value in radians.
void Matrix4D::rotY | ( | double | fAngle | ) |
Rotate around the Y axis (in transformed space) for the given value in radians.
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().
void Matrix4D::scale | ( | const Vector3d & | rclVct | ) |
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by automotive_design.cartesian_transformation_operator::scl(), config_control_design.cartesian_transformation_operator::scl(), ifc2x3.ifccartesiantransformationoperator::scl(), and ifc4.ifccartesiantransformationoperator::scl().
void Matrix4D::scale | ( | const Vector3f & | rclVct | ) |
scale for the x,y,z value
References scale().
Referenced by automotive_design.cartesian_transformation_operator::scl(), config_control_design.cartesian_transformation_operator::scl(), ifc2x3.ifccartesiantransformationoperator::scl(), and ifc4.ifccartesiantransformationoperator::scl().
void Base::Matrix4D::scale | ( | double | scalexyz | ) |
void Base::Matrix4D::scale | ( | double | x, |
double | y, | ||
double | z | ||
) |
void Base::Matrix4D::scale | ( | float | scalexyz | ) |
void Base::Matrix4D::scale | ( | float | x, |
float | y, | ||
float | z | ||
) |
scale for the vector
References draftfunctions.scale::scale().
Referenced by App::LinkBaseExtension::extensionGetSubObject(), Base::ViewProjMatrix::getProjectionMatrix(), App::LinkBaseExtension::getTransform(), TechDraw::ShapeExtractor::getXShapes(), DraftUtils::DraftDxfRead::OnReadInsert(), Import::ImpExpDxfRead::OnReadInsert(), scale(), automotive_design.cartesian_transformation_operator::scl(), config_control_design.cartesian_transformation_operator::scl(), ifc2x3.ifccartesiantransformationoperator::scl(), ifc4.ifccartesiantransformationoperator::scl(), and Gui::ViewProviderLink::updateDataPrivate().
void Base::Matrix4D::setCol | ( | unsigned short | usNdx, |
const Vector3d & | v | ||
) |
Set column to vector.
void Matrix4D::setGLMatrix | ( | const double | dMtrx[16] | ) |
set the matrix in OpenGL style
Referenced by inverseGauss().
void Matrix4D::setMatrix | ( | const double | dMtrx[16] | ) |
void Base::Matrix4D::setRow | ( | unsigned short | usNdx, |
const Vector3d & | v | ||
) |
Set row to vector.
void Matrix4D::setToUnity | ( | ) |
Makes unity matrix.
Referenced by MeshCore::FunctionContainer::GetHessian(), MeshCore::AbstractPolygonTriangulator::GetTransformToFitPlane(), Hat(), Base::Rotation::makeRotationByAxes(), Outer(), Mesh::PropertyNormalList::transformGeometry(), Mesh::PropertyCurvatureList::transformGeometry(), Points::PropertyNormalList::transformGeometry(), and Points::PropertyCurvatureList::transformGeometry().
void Base::Matrix4D::setTrace | ( | const Vector3d & | v | ) |
Set trace to vector.
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().
std::string Matrix4D::toString | ( | ) | const |
write the 16 double of the matrix into a string
Vector3d Base::Matrix4D::trace | ( | ) | const |
Get vector of trace.
transform (move,scale,rotate) around a point
References move().
Referenced by importSVG.svgHandler::applyTrans(), importSVG.svgHandler::characters(), importSVG.svgHandler::endElement(), ArchSite.Compass::locate(), ArchSite.Compass::rotate(), rotLine(), and ArchSite.Compass::scale().
void Matrix4D::transpose | ( | ) |
Referenced by analyse(), and inverseOrthogonal().