FEDEM Solver  R8.0
Source code of the dynamics solver
Public Member Functions | Private Attributes | Friends | List of all members
FaMat34 Class Reference

Class for positions in 3D space. More...

#include <FFaMat34.H>

Collaboration diagram for FaMat34:
Collaboration graph
[legend]

Public Member Functions

 FaMat34 ()
 Default constructor creating an identity matrix at the origin. More...
 
 FaMat34 (const float *mat)
 Constructor creating a matrix from a float array. More...
 
 FaMat34 (const double *mat)
 Constructor creating a matrix from a double array. More...
 
 FaMat34 (const FaVec3 &pos)
 Constructor creating an identity matrix at the the point pos. More...
 
 FaMat34 (const FaVec3 &v0, const FaVec3 &v1, const FaVec3 &v2, const FaVec3 &v3)
 Constructor creating a identity matrix from four column vectors. More...
 
 FaMat34 (const FaMat33 &m, const FaVec3 &v)
 Constructor creating a matrix from given rotation and position. More...
 
FaMat34 & operator+= (const FaMat34 &m)
 Addition operator. More...
 
FaMat34 & operator+= (const FaVec3 &v)
 Addition operator, position only. More...
 
FaMat34 & operator-= (const FaMat34 &m)
 Subtraction operator. More...
 
FaMat34 & operator-= (const FaVec3 &v)
 Subtraction operator, position only. More...
 
FaMat34 & operator*= (double d)
 Scaling operator (multiplication by a scalar). More...
 
FaMat34 & operator/= (double d)
 Scaling operator (division by a scalar). More...
 
const FaVec3 & operator[] (int i) const
 Zero-based indexing operator accessing a matrix column (read only). More...
 
FaVec3 & operator[] (int i)
 Zero-based indexing operator accessing a column (for update). More...
 
const double & operator() (int i, int j) const
 One-based indexing operator accessing a matrix element (read only). More...
 
double & operator() (int i, int j)
 One-based indexing operator accessing an element (for update). More...
 
const FaMat33 & direction () const
 Returns a const reference to the orientation matrix r. More...
 
const FaVec3 & translation () const
 Returns a const reference to the position vector p. More...
 
FaMat34 inverse () const
 Returns the inverse of the matrix. More...
 
FaMat34 & setIdentity ()
 Initializes the matrix to the indentity rotation at the origin. More...
 
bool isCoincident (const FaMat34 &m, double tolerance=1.0e-10) const
 Returns true if the matrix m equals *this within the given tolerance. More...
 
FaMat34 & eulerRotateZYX (const FaVec3 &anglesXYZ, const FaMat34 &fromMatrix)
 Computes a relative rotation from the given Euler angles. More...
 
FaMat34 & eulerRotateZYX (const FaVec3 &anglesXYZ)
 Computes an incremental rotation from the given Euler angles. More...
 
FaMat34 & eulerTransform (const FaVec3 &offsetXYZ, const FaVec3 &anglesXYZ, const FaMat34 &fromMatrix)
 Computes a relative rotation from given Euler angles and offset. More...
 
FaMat34 & quatrTransform (const FaVec3 &offsetXYZ, const FaVec3 &anglesXYZ, const FaMat34 &fromMatrix)
 Computes a relative rotation from given rotation angles and offset. More...
 
FaMat34 & makeGlobalizedCS (const FaVec3 &origin, const FaVec3 &p1)
 Computes a globalized coordinate system from trwo vectors. More...
 
FaMat34 & makeGlobalizedCS (const FaVec3 &origin, const FaVec3 &p1, const FaVec3 &p2)
 Computes a globalized coordinate system from three vectors. More...
 
FaMat34 & makeGlobalizedCS (const FaVec3 &origin, const FaVec3 &p1, const FaVec3 &p2, const FaVec3 &p3)
 Computes a globalized coordinate system from four vectors. More...
 
FaMat34 & makeCS_X_XY (const FaVec3 &origin, const FaVec3 &xpt, const FaVec3 &xypl)
 Computes a coordinate from points in the XY-plane and the X-axis. More...
 
FaMat34 & makeCS_X_XZ (const FaVec3 &origin, const FaVec3 &xpt, const FaVec3 &xzpl)
 Computes a coordinate from points in the XZ-plane and the X-axis. More...
 
FaMat34 & makeCS_Z_XZ (const FaVec3 &origin, const FaVec3 &zpt, const FaVec3 &xzpl)
 Computes a coordinate from points in the XZ-plane and the Z-axis. More...
 
FaVec3 projectOnXY (const FaVec3 &x) const
 Calculates the projection of x onto the XY-plane of this matrix. More...
 
FaVec3 getEulerZYX () const
 Returns the Euler angles corresponding to the orientation r. More...
 
FaVec3 getEulerZYX (const FaMat34 &from) const
 Returns the Euler angles corresponding to a relative rotation. More...
 
double getEulerZYX (int i) const
 Returns the i'th Euler angle corresponding to r. More...
 
double getEulerZYX (int i, const FaMat34 &from) const
 Returns the i'th Euler angle of a relative rotation. More...
 
double getRotation (int i) const
 Returns the angles corresponding to the orientation r. More...
 
double getRotation (int i, const FaMat34 &from) const
 Returns the i'th angle corresponding to a relative rotation. More...
 
std::ostream & printStd (std::ostream &os) const
 Writes the matrix to the provided output stream. More...
 
std::ostream & printRot (std::ostream &os) const
 Writes the matrix to the provided output stream. More...
 
bool readStd (std::istream &s)
 Reads the matrix from the provided input stream. More...
 
bool readRot (std::istream &s)
 Reads the matrix from the provided input stream. More...
 

Private Attributes

FaMat33 r
 Orientation matrix. More...
 
FaVec3 p
 Position vector. More...
 

Friends

FaMat34 operator- (const FaMat34 &a)
 Unary negation operator. More...
 
FaMat34 operator+ (const FaMat34 &a, const FaMat34 &b)
 Global addition operator. More...
 
FaMat34 operator+ (const FaMat34 &a, const FaVec3 &b)
 Global addition operator, positions only. More...
 
FaMat34 operator- (const FaMat34 &a, const FaMat34 &b)
 Global subtraction operator. More...
 
FaMat34 operator- (const FaMat34 &a, const FaVec3 &b)
 Global subtraction operator, positions only. More...
 
FaMat34 operator* (const FaMat34 &a, const FaMat34 &b)
 Multiplication of two matrices. More...
 
FaMat34 operator* (const FaMat34 &a, const FaMat33 &b)
 Multiplication of two matrices, rotations only. More...
 
FaVec3 operator* (const FaMat34 &a, const FaVec3 &b)
 Multiplication of a matrix and a point vector. More...
 
bool operator== (const FaMat34 &a, const FaMat34 &b)
 Equality operator. More...
 
bool operator!= (const FaMat34 &a, const FaMat34 &b)
 Inequality operator. More...
 
std::ostream & operator<< (std::ostream &s, const FaMat34 &m)
 Printing operator. More...
 
std::istream & operator>> (std::istream &s, FaMat34 &m)
 Reading operator. More...
 

Detailed Description

Class for positions in 3D space.

This class is a 3×4 matrix actually representing a 4×4 matrix defining the position and orientation of a point in 3D space, or a coordinate system with axis directions and origin offset. The class is equipped with many convenience methods for the most common operations on position objects. Many of the mathematical opertions are defined as is if the fourth row of the matrix equals 0 0 0 1. This row is however not stored.

Matrix layout:

[0][0] [1][0] [2][0] [3][0]
[0][1] [1][1] [2][1] [3][1]
[0][2] [1][2] [2][2] [3][2]

Constructor & Destructor Documentation

◆ FaMat34() [1/6]

FaMat34::FaMat34 ( )
inline

Default constructor creating an identity matrix at the origin.

◆ FaMat34() [2/6]

FaMat34::FaMat34 ( const float *  mat)
inline

Constructor creating a matrix from a float array.

◆ FaMat34() [3/6]

FaMat34::FaMat34 ( const double *  mat)
inline

Constructor creating a matrix from a double array.

◆ FaMat34() [4/6]

FaMat34::FaMat34 ( const FaVec3 &  pos)
inlineexplicit

Constructor creating an identity matrix at the the point pos.

◆ FaMat34() [5/6]

FaMat34::FaMat34 ( const FaVec3 &  v0,
const FaVec3 &  v1,
const FaVec3 &  v2,
const FaVec3 &  v3 
)
inline

Constructor creating a identity matrix from four column vectors.

◆ FaMat34() [6/6]

FaMat34::FaMat34 ( const FaMat33 &  m,
const FaVec3 &  v 
)
inline

Constructor creating a matrix from given rotation and position.

Member Function Documentation

◆ direction()

const FaMat33& FaMat34::direction ( ) const
inline

Returns a const reference to the orientation matrix r.

◆ eulerRotateZYX() [1/2]

FaMat34 & FaMat34::eulerRotateZYX ( const FaVec3 &  anglesXYZ)

Computes an incremental rotation from the given Euler angles.

◆ eulerRotateZYX() [2/2]

FaMat34 & FaMat34::eulerRotateZYX ( const FaVec3 &  anglesXYZ,
const FaMat34 &  fromMatrix 
)

Computes a relative rotation from the given Euler angles.

◆ eulerTransform()

FaMat34 & FaMat34::eulerTransform ( const FaVec3 &  offsetXYZ,
const FaVec3 &  anglesXYZ,
const FaMat34 &  fromMatrix 
)

Computes a relative rotation from given Euler angles and offset.

◆ getEulerZYX() [1/4]

FaVec3 FaMat34::getEulerZYX ( ) const

Returns the Euler angles corresponding to the orientation r.

◆ getEulerZYX() [2/4]

FaVec3 FaMat34::getEulerZYX ( const FaMat34 &  from) const

Returns the Euler angles corresponding to a relative rotation.

◆ getEulerZYX() [3/4]

double FaMat34::getEulerZYX ( int  i) const

Returns the i'th Euler angle corresponding to r.

◆ getEulerZYX() [4/4]

double FaMat34::getEulerZYX ( int  i,
const FaMat34 &  from 
) const

Returns the i'th Euler angle of a relative rotation.

◆ getRotation() [1/2]

double FaMat34::getRotation ( int  i) const

Returns the angles corresponding to the orientation r.

◆ getRotation() [2/2]

double FaMat34::getRotation ( int  i,
const FaMat34 &  from 
) const

Returns the i'th angle corresponding to a relative rotation.

◆ inverse()

FaMat34 FaMat34::inverse ( ) const

Returns the inverse of the matrix.

◆ isCoincident()

bool FaMat34::isCoincident ( const FaMat34 &  m,
double  tolerance = 1.0e-10 
) const

Returns true if the matrix m equals *this within the given tolerance.

◆ makeCS_X_XY()

FaMat34 & FaMat34::makeCS_X_XY ( const FaVec3 &  origin,
const FaVec3 &  xpt,
const FaVec3 &  xypl 
)

Computes a coordinate from points in the XY-plane and the X-axis.

◆ makeCS_X_XZ()

FaMat34 & FaMat34::makeCS_X_XZ ( const FaVec3 &  origin,
const FaVec3 &  xpt,
const FaVec3 &  xzpl 
)

Computes a coordinate from points in the XZ-plane and the X-axis.

◆ makeCS_Z_XZ()

FaMat34 & FaMat34::makeCS_Z_XZ ( const FaVec3 &  origin,
const FaVec3 &  zpt,
const FaVec3 &  xzpl 
)

Computes a coordinate from points in the XZ-plane and the Z-axis.

◆ makeGlobalizedCS() [1/3]

FaMat34 & FaMat34::makeGlobalizedCS ( const FaVec3 &  origin,
const FaVec3 &  p1 
)

Computes a globalized coordinate system from trwo vectors.

◆ makeGlobalizedCS() [2/3]

FaMat34 & FaMat34::makeGlobalizedCS ( const FaVec3 &  origin,
const FaVec3 &  p1,
const FaVec3 &  p2 
)

Computes a globalized coordinate system from three vectors.

◆ makeGlobalizedCS() [3/3]

FaMat34 & FaMat34::makeGlobalizedCS ( const FaVec3 &  origin,
const FaVec3 &  p1,
const FaVec3 &  p2,
const FaVec3 &  p3 
)

Computes a globalized coordinate system from four vectors.

◆ operator()() [1/2]

double & FaMat34::operator() ( int  i,
int  j 
)
inline

One-based indexing operator accessing an element (for update).

◆ operator()() [2/2]

const double & FaMat34::operator() ( int  i,
int  j 
) const
inline

One-based indexing operator accessing a matrix element (read only).

◆ operator*=()

FaMat34 & FaMat34::operator*= ( double  d)

Scaling operator (multiplication by a scalar).

◆ operator+=() [1/2]

FaMat34 & FaMat34::operator+= ( const FaMat34 &  m)

Addition operator.

◆ operator+=() [2/2]

FaMat34 & FaMat34::operator+= ( const FaVec3 &  v)

Addition operator, position only.

◆ operator-=() [1/2]

FaMat34 & FaMat34::operator-= ( const FaMat34 &  m)

Subtraction operator.

◆ operator-=() [2/2]

FaMat34 & FaMat34::operator-= ( const FaVec3 &  v)

Subtraction operator, position only.

◆ operator/=()

FaMat34 & FaMat34::operator/= ( double  d)

Scaling operator (division by a scalar).

◆ operator[]() [1/2]

FaVec3 & FaMat34::operator[] ( int  i)
inline

Zero-based indexing operator accessing a column (for update).

◆ operator[]() [2/2]

const FaVec3 & FaMat34::operator[] ( int  i) const
inline

Zero-based indexing operator accessing a matrix column (read only).

◆ printRot()

std::ostream & FaMat34::printRot ( std::ostream &  os) const

Writes the matrix to the provided output stream.

This method writes a reduced homogenous transformation matrix. Format:

R1x R1y R1z
R2x R2y R3z
R3x R3y R3z
Tx Ty Tz

◆ printStd()

std::ostream & FaMat34::printStd ( std::ostream &  os) const

Writes the matrix to the provided output stream.

This method writes a reduced homogenous transformation matrix. Format:

R1x R2x R3x Tx
R1y R2y R3y Ty
R1z R2z R3z Tz

◆ projectOnXY()

FaVec3 FaMat34::projectOnXY ( const FaVec3 &  x) const

Calculates the projection of x onto the XY-plane of this matrix.

◆ quatrTransform()

FaMat34 & FaMat34::quatrTransform ( const FaVec3 &  offsetXYZ,
const FaVec3 &  anglesXYZ,
const FaMat34 &  fromMatrix 
)

Computes a relative rotation from given rotation angles and offset.

◆ readRot()

bool FaMat34::readRot ( std::istream &  s)

Reads the matrix from the provided input stream.

This method reads a reduced homogenous transformation matrix. Format:

R1x R1y R1z
R2x R2y R3z
R3x R3y R3z
Tx Ty Tz

◆ readStd()

bool FaMat34::readStd ( std::istream &  s)

Reads the matrix from the provided input stream.

This method reads a reduced homogenous transformation matrix. Format:

R1x R2x R3x Tx
R1y R2y R3y Ty
R1z R2z R3z Tz

◆ setIdentity()

FaMat34 & FaMat34::setIdentity ( )

Initializes the matrix to the indentity rotation at the origin.

◆ translation()

const FaVec3& FaMat34::translation ( ) const
inline

Returns a const reference to the position vector p.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const FaMat34 &  a,
const FaMat34 &  b 
)
friend

Inequality operator.

◆ operator* [1/3]

FaMat34 operator* ( const FaMat34 &  a,
const FaMat33 &  b 
)
friend

Multiplication of two matrices, rotations only.

◆ operator* [2/3]

FaMat34 operator* ( const FaMat34 &  a,
const FaMat34 &  b 
)
friend

Multiplication of two matrices.

◆ operator* [3/3]

FaVec3 operator* ( const FaMat34 &  a,
const FaVec3 &  b 
)
friend

Multiplication of a matrix and a point vector.

◆ operator+ [1/2]

FaMat34 operator+ ( const FaMat34 &  a,
const FaMat34 &  b 
)
friend

Global addition operator.

◆ operator+ [2/2]

FaMat34 operator+ ( const FaMat34 &  a,
const FaVec3 &  b 
)
friend

Global addition operator, positions only.

◆ operator- [1/3]

FaMat34 operator- ( const FaMat34 &  a)
friend

Unary negation operator.

◆ operator- [2/3]

FaMat34 operator- ( const FaMat34 &  a,
const FaMat34 &  b 
)
friend

Global subtraction operator.

◆ operator- [3/3]

FaMat34 operator- ( const FaMat34 &  a,
const FaVec3 &  b 
)
friend

Global subtraction operator, positions only.

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const FaMat34 &  m 
)
friend

Printing operator.

◆ operator==

bool operator== ( const FaMat34 &  a,
const FaMat34 &  b 
)
friend

Equality operator.

◆ operator>>

std::istream& operator>> ( std::istream &  s,
FaMat34 &  m 
)
friend

Reading operator.

Member Data Documentation

◆ p

FaVec3 FaMat34::p
private

Position vector.

◆ r

FaMat33 FaMat34::r
private

Orientation matrix.


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