Base::Matrix4D Class Reference

The Matrix4D class. More...

#include <Matrix.h>

List of all members.

Public Member Functions

void fromString (const std::string &str)
 read the 16 double of the matrix from a string
void getGLMatrix (double dMtrx[16]) const
 get the matrix in OpenGL style
unsigned long getMemSpace (void)
 Matrix4D (const Vector3d &rclBase, const Vector3d &rclDir, double fAngle)
 Matrix4D (const Vector3f &rclBase, const Vector3f &rclDir, float fAngle)
 Construction with an Axis.
 Matrix4D (const Matrix4D &rclMtrx)
 Construction.
 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)
 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 (void)
 default constructor
void Print (void) const
void setGLMatrix (const double dMtrx[16])
 set the matrix in OpenGL style
std::string toString (void) const
 write the 16 double of the matrix into a string
 ~Matrix4D ()
 Destruction.
Operators



double determinant () const
 Compute the determinant of the matrix.
bool operator!= (const Matrix4D &rclMtrx) const
 Comparison.
Vector3d operator* (const Vector3d &rclVct) const
Vector3f operator* (const Vector3f &rclVct) const
 Multiplication matrix with vector.
Matrix4D operator* (const Matrix4D &rclMtrx) const
 Matrix multiplication.
Matrix4Doperator*= (const Matrix4D &rclMtrx)
 Matrix multiplication.
Matrix4D operator+ (const Matrix4D &rclMtrx) const
 Matrix addition.
Matrix4Doperator+= (const Matrix4D &rclMtrx)
Matrix4D operator- (const Matrix4D &rclMtrx) const
 Matrix subtraction.
Matrix4Doperator-= (const Matrix4D &rclMtrx)
Matrix4Doperator= (const Matrix4D &rclMtrx)
 Assignment.
bool operator== (const Matrix4D &rclMtrx) const
 Comparison.
const double * operator[] (unsigned short usNdx) const
 Index operator.
double * operator[] (unsigned short usNdx)
 Index operator.
Manipulation



void inverse (void)
void inverseGauss (void)
void move (const Vector3d &rclVct)
void move (const Vector3f &rclVct)
 moves the coordinatesystem for the vector
void move (float x, float y, float z)
 moves the coordinatesystem for the x,y,z value
void rotLine (const Vector3d &rclBase, const Vector3d &rclDir, double fAngle)
void rotLine (const Vector3f &rclBase, const Vector3f &rclDir, float fAngle)
 Rotation around an arbitrary axis that needn't necessarily pass the origin.
void rotLine (const Vector3d &rclVct, double fAngle)
void rotLine (const Vector3f &rclVct, float fAngle)
 Rotation around an arbitrary axis passing the origin.
void rotX (double fAngle)
 rotate around the X axis for the given value
void rotY (double fAngle)
 rotate around the Y axis for the given value
void rotZ (double fAngle)
 rotate around the Z axis for the given value
void scale (const Vector3d &rclVct)
void scale (const Vector3f &rclVct)
 scale for the x,y,z value
void scale (float x, float y, float z)
 scale for the vector
void setToUnity (void)
 Makes unity matrix.
bool toAxisAngle (Vector3f &rclBase, Vector3f &rclDir, float &fAngle, float &fTranslation) const
 Extract the rotation axis and angle. Therefore the 3x3 submatrix must be orthogonal.
void transform (const Vector3d &rclVct, const Matrix4D &rclMtrx)
void transform (const Vector3f &rclVct, const Matrix4D &rclMtrx)
 transform (move,scale,rotate) around a point
void transpose (void)

Detailed Description

The Matrix4D class.

Definition at line 40 of file Matrix.h.


Constructor & Destructor Documentation

Matrix4D::Matrix4D ( void   ) 

default constructor

Definition at line 36 of file Matrix.cpp.

References setToUnity().

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.

Definition at line 41 of file Matrix.cpp.

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 
)

Definition at line 52 of file Matrix.cpp.

Matrix4D::Matrix4D ( const Matrix4D rclMtrx  ) 

Construction.

Definition at line 64 of file Matrix.cpp.

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

Construction with an Axis.

Definition at line 69 of file Matrix.cpp.

References rotLine(), and setToUnity().

Base::Matrix4D::Matrix4D ( const Vector3d rclBase,
const Vector3d rclDir,
double  fAngle 
)
Base::Matrix4D::~Matrix4D (  )  [inline]

Destruction.

Definition at line 62 of file Matrix.h.


Member Function Documentation

double Matrix4D::determinant (  )  const

Compute the determinant of the matrix.

Definition at line 83 of file Matrix.cpp.

Referenced by Part::TopoShape::transformGShape(), and Part::TopoShape::transformShape().

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

read the 16 double of the matrix from a string

Definition at line 664 of file Matrix.cpp.

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

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

get the matrix in OpenGL style

Definition at line 604 of file Matrix.cpp.

Referenced by Gui::ViewProvider::convert(), inverseGauss(), and Gui::ViewProvider::setTransformation().

unsigned long Matrix4D::getMemSpace ( void   ) 

Definition at line 622 of file Matrix.cpp.

void Matrix4D::inverse ( void   ) 
void Matrix4D::inverseGauss ( void   ) 

Definition at line 589 of file Matrix.cpp.

References getGLMatrix(), Matrix_gauss(), and setGLMatrix().

void Matrix4D::move ( const Vector3d rclVct  ) 
void Matrix4D::move ( const Vector3f rclVct  ) 

moves the coordinatesystem for the vector

Definition at line 126 of file Matrix.cpp.

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

void Base::Matrix4D::move ( float  x,
float  y,
float  z 
) [inline]

moves the coordinatesystem for the x,y,z value

Definition at line 105 of file Matrix.h.

References move().

Referenced by Data::ComplexGeoData::applyTranslation(), Base::MatrixPy::move(), move(), rotLine(), transform(), and Mesh::MeshPy::translate().

bool Base::Matrix4D::operator!= ( const Matrix4D rclMtrx  )  const [inline]

Comparison.

Definition at line 281 of file Matrix.h.

Vector3d Base::Matrix4D::operator* ( const Vector3d rclVct  )  const [inline]
Vector3f Base::Matrix4D::operator* ( const Vector3f rclVct  )  const [inline]

Multiplication matrix with vector.

Definition at line 249 of file Matrix.h.

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

Matrix4D Base::Matrix4D::operator* ( const Matrix4D rclMtrx  )  const [inline]

Matrix multiplication.

Definition at line 220 of file Matrix.h.

Matrix4D & Base::Matrix4D::operator*= ( const Matrix4D rclMtrx  )  [inline]

Matrix multiplication.

Definition at line 202 of file Matrix.h.

Matrix4D Base::Matrix4D::operator+ ( const Matrix4D rclMtrx  )  const [inline]

Matrix addition.

Definition at line 148 of file Matrix.h.

Matrix4D & Base::Matrix4D::operator+= ( const Matrix4D rclMtrx  )  [inline]

Definition at line 162 of file Matrix.h.

Matrix4D Base::Matrix4D::operator- ( const Matrix4D rclMtrx  )  const [inline]

Matrix subtraction.

Definition at line 175 of file Matrix.h.

Matrix4D & Base::Matrix4D::operator-= ( const Matrix4D rclMtrx  )  [inline]

Definition at line 189 of file Matrix.h.

Matrix4D & Base::Matrix4D::operator= ( const Matrix4D rclMtrx  )  [inline]

Assignment.

Definition at line 236 of file Matrix.h.

bool Base::Matrix4D::operator== ( const Matrix4D rclMtrx  )  const [inline]

Comparison.

Definition at line 269 of file Matrix.h.

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

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

Index operator.

Definition at line 298 of file Matrix.h.

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

Index operator.

Definition at line 293 of file Matrix.h.

void Matrix4D::Print ( void   )  const

Definition at line 627 of file Matrix.cpp.

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

Definition at line 286 of file Matrix.cpp.

References SketcherExample::f, move(), and rotLine().

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

Rotation around an arbitrary axis that needn't necessarily pass the origin.

Definition at line 300 of file Matrix.cpp.

References SketcherExample::f, move(), and rotLine().

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

Rotation around an arbitrary axis passing the origin.

Definition at line 280 of file Matrix.cpp.

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

Referenced by Matrix4D(), and rotLine().

void Matrix4D::rotX ( double  fAngle  ) 

rotate around the X axis for the given value

Definition at line 190 of file Matrix.cpp.

References KDL::cos(), and KDL::sin().

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

void Matrix4D::rotY ( double  fAngle  ) 

rotate around the Y axis for the given value

Definition at line 203 of file Matrix.cpp.

References KDL::cos(), and KDL::sin().

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

void Matrix4D::rotZ ( double  fAngle  ) 

rotate around the Z axis for the given value

Definition at line 216 of file Matrix.cpp.

References KDL::cos(), and KDL::sin().

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

void Matrix4D::scale ( const Vector3d rclVct  ) 
void Matrix4D::scale ( const Vector3f rclVct  ) 

scale for the x,y,z value

Definition at line 171 of file Matrix.cpp.

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

void Base::Matrix4D::scale ( float  x,
float  y,
float  z 
) [inline]

scale for the vector

Definition at line 111 of file Matrix.h.

References scale().

Referenced by Base::MatrixPy::scale(), and scale().

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

set the matrix in OpenGL style

Definition at line 613 of file Matrix.cpp.

Referenced by inverseGauss().

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

Definition at line 325 of file Matrix.cpp.

References KDL::acos(), SketcherExample::f, F_PI, boost::numeric::bindings::umfpack::detail::factor(), Base::Vector3< _Precision >::Normalize(), KDL::sin(), KDL::sqrt(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

Referenced by Base::InventorBuilder::addTransformation(), and Base::Builder3D::addTransformation().

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

write the 16 double of the matrix into a string

Definition at line 651 of file Matrix.cpp.

Referenced by Points::PointKernel::Save().

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

Definition at line 458 of file Matrix.cpp.

References move().

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

transform (move,scale,rotate) around a point

Definition at line 452 of file Matrix.cpp.

References move().

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

void Matrix4D::transpose ( void   ) 

Definition at line 635 of file Matrix.cpp.


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

Generated on Wed Nov 23 19:01:47 2011 for FreeCAD by  doxygen 1.6.1