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

Class for point transformations in 3D space. More...

#include <FFaMat33.H>

Collaboration diagram for FaMat33:
Collaboration graph
[legend]

Public Member Functions

 FaMat33 ()
 Default constructor creating an identity matrix. More...
 
 FaMat33 (const float *mat)
 Constructor creating a matrix from a float array. More...
 
 FaMat33 (const double *mat)
 Constructor creating a matrix from a double array. More...
 
 FaMat33 (const FaVec3 &v0, const FaVec3 &v1, const FaVec3 &v2)
 Constructor creating a matrix from 3 column vectors. More...
 
FaMat33 & operator+= (const FaMat33 &m)
 Addition operator. More...
 
FaMat33 & operator-= (const FaMat33 &m)
 Subtraction operator. More...
 
FaMat33 & operator*= (double d)
 Scaling operator (multiplication by a scalar). More...
 
FaMat33 & 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...
 
FaMat33 inverse (double eps=1.0e-16) const
 Returns the inverse of the matrix. More...
 
FaMat33 & setIdentity ()
 Initializes the matrix to the identity matrix. More...
 
FaMat33 transpose () const
 Returns the transpose of matrix. More...
 
FaMat33 & shift (int delta)
 Performs a cyclic permutation of the matrix columns. More...
 
bool isCoincident (const FaMat33 &m, double tolerance=1.0e-10) const
 Returns true if the matrix m equals *this within the given tolerance. More...
 
FaMat33 & makeGlobalizedCS (const FaVec3 &v1)
 Computes a globalized coordinate system from an X-axis vector. More...
 
FaMat33 & makeGlobalizedCS (const FaVec3 &v1, const FaVec3 &v2)
 Computes a globalized coordinate system from two in-plane vectors. More...
 
FaMat33 & makeGlobalizedCS (const FaVec3 &v0, const FaVec3 &v1, const FaVec3 &v2)
 Computes a globalized coordinate system from three vectors. More...
 
FaMat33 & makeGlobalizedCS (const FaVec3 &v1, const FaVec3 &v2, const FaVec3 &v3, const FaVec3 &v4)
 Computes a globalized coordinate system from four vectors. More...
 
FaMat33 & eulerRotateZYX (const FaVec3 &angles)
 Compute an incremental rotation tensor from the given Euler angles. More...
 
FaMat33 & incRotate (const FaVec3 &angles)
 Computes an incremental rotation tensor from the given angles. More...
 
FaVec3 getEulerZYX () const
 Returns the Euler angles corresponding to an incremental rotation. More...
 
FaVec3 getRotation () const
 Returns the angles corresponding to an incremental rotation. More...
 

Static Public Member Functions

static FaMat33 makeZrotation (double angle)
 Returns the matrix representing a rotation about the Z-axis. More...
 
static FaMat33 makeYrotation (double angle)
 Returns the matrix representing a rotation about the Y-axis. More...
 
static FaMat33 makeXrotation (double angle)
 Returns the matrix representing a rotation about the X-axis. More...
 

Private Attributes

FaVec3 v [3]
 Columns of the 3×3 matrix. More...
 

Friends

FaMat33 operator- (const FaMat33 &a)
 Unary negation operator. More...
 
FaMat33 operator+ (const FaMat33 &a, const FaMat33 &b)
 Global addition operator. More...
 
FaMat33 operator- (const FaMat33 &a, const FaMat33 &b)
 Global subtraction operator. More...
 
FaMat33 operator* (const FaMat33 &a, const FaMat33 &b)
 Multiplication of two matrices. More...
 
FaMat33 operator* (const FaMat33 &a, double d)
 Scaling operator, multiplication of a matrix and a scalar. More...
 
FaMat33 operator* (double d, const FaMat33 &a)
 Scaling operator, multiplication of a scalar and a matrix. More...
 
FaVec3 operator* (const FaMat33 &a, const FaVec3 &b)
 Multiplication of a matrix and a point vector. More...
 
FaVec3 operator* (const FaVec3 &a, const FaMat33 &b)
 Multiplication of a point vector and matrix. More...
 
FaMat33 operator/ (const FaMat33 &a, double d)
 Scaling operator, division by a scalar. More...
 
int operator== (const FaMat33 &a, const FaMat33 &b)
 Equality operator. More...
 
int operator!= (const FaMat33 &a, const FaMat33 &b)
 Inequality operator. More...
 
std::ostream & operator<< (std::ostream &s, const FaMat33 &m)
 Printing operator. More...
 
std::istream & operator>> (std::istream &s, FaMat33 &m)
 Reading operator. More...
 

Detailed Description

Class for point transformations in 3D space.

This class is a 3×3 matrix representing the coordinate system axes or a transformation of 3D point vectors. The class is equipped with many convenience methods for the most common operations on such objects.

Matrix layout:

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

Constructor & Destructor Documentation

◆ FaMat33() [1/4]

FaMat33::FaMat33 ( )
inline

Default constructor creating an identity matrix.

◆ FaMat33() [2/4]

FaMat33::FaMat33 ( const float *  mat)

Constructor creating a matrix from a float array.

◆ FaMat33() [3/4]

FaMat33::FaMat33 ( const double *  mat)

Constructor creating a matrix from a double array.

◆ FaMat33() [4/4]

FaMat33::FaMat33 ( const FaVec3 &  v0,
const FaVec3 &  v1,
const FaVec3 &  v2 
)

Constructor creating a matrix from 3 column vectors.

Member Function Documentation

◆ eulerRotateZYX()

FaMat33 & FaMat33::eulerRotateZYX ( const FaVec3 &  angles)

Compute an incremental rotation tensor from the given Euler angles.

◆ getEulerZYX()

FaVec3 FaMat33::getEulerZYX ( ) const

Returns the Euler angles corresponding to an incremental rotation.

◆ getRotation()

FaVec3 FaMat33::getRotation ( ) const

Returns the angles corresponding to an incremental rotation.

This function is equivalent to the Fortran subroutine rotationmodule::mat_to_vec in the module rotationmodule (see the src/vpmUtilities directory).

◆ incRotate()

FaMat33 & FaMat33::incRotate ( const FaVec3 &  angles)

Computes an incremental rotation tensor from the given angles.

The incremental rotation tensor is computed from the rotation angles using a quaternion representation of the rotation. This function is equivalent to the Fortran subroutine rotationmodule::vec_to_mat in the module rotationmodule (see the src/vpmUtilities directory). The angles provided are those related to a Rodrigues parameterization. Rotation axis, with length equal to the angle to rotate about that axis.

◆ inverse()

FaMat33 FaMat33::inverse ( double  eps = 1.0e-16) const

Returns the inverse of the matrix.

Parameters
[in]epsZero tolerance for the matrix determinant

◆ isCoincident()

bool FaMat33::isCoincident ( const FaMat33 &  oMat,
double  tolerance = 1.0e-10 
) const

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

The two matrices are considered identical if their respecive column vectors are parallel and not in the opposite direction.

◆ makeGlobalizedCS() [1/4]

FaMat33 & FaMat33::makeGlobalizedCS ( const FaVec3 &  v0,
const FaVec3 &  v1,
const FaVec3 &  v2 
)

Computes a globalized coordinate system from three vectors.

◆ makeGlobalizedCS() [2/4]

FaMat33 & FaMat33::makeGlobalizedCS ( const FaVec3 &  v1)

Computes a globalized coordinate system from an X-axis vector.

Compute a globalized coordinate system where the X-axis is parallel to the given vector v1, and the two other axes are as close as possible to the corresponding global coordinate axes.

◆ makeGlobalizedCS() [3/4]

FaMat33 & FaMat33::makeGlobalizedCS ( const FaVec3 &  v1,
const FaVec3 &  v2 
)

Computes a globalized coordinate system from two in-plane vectors.

Compute a globalized coordinate system in the plane defined by the two given vectors v1 and v2, such that the local Z-axis is parallell to the normal vector of the plane, and the two other axes are as close as possible to the corresponding global coordinate axes.

◆ makeGlobalizedCS() [4/4]

FaMat33 & FaMat33::makeGlobalizedCS ( const FaVec3 &  v1,
const FaVec3 &  v2,
const FaVec3 &  v3,
const FaVec3 &  v4 
)

Computes a globalized coordinate system from four vectors.

◆ makeXrotation()

FaMat33 FaMat33::makeXrotation ( double  angle)
static

Returns the matrix representing a rotation about the X-axis.

◆ makeYrotation()

FaMat33 FaMat33::makeYrotation ( double  angle)
static

Returns the matrix representing a rotation about the Y-axis.

◆ makeZrotation()

FaMat33 FaMat33::makeZrotation ( double  angle)
static

Returns the matrix representing a rotation about the Z-axis.

◆ operator()() [1/2]

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

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

◆ operator()() [2/2]

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

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

◆ operator*=()

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

Scaling operator (multiplication by a scalar).

◆ operator+=()

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

Addition operator.

◆ operator-=()

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

Subtraction operator.

◆ operator/=()

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

Scaling operator (division by a scalar).

◆ operator[]() [1/2]

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

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

◆ operator[]() [2/2]

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

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

◆ setIdentity()

FaMat33 & FaMat33::setIdentity ( )

Initializes the matrix to the identity matrix.

◆ shift()

FaMat33 & FaMat33::shift ( int  delta)

Performs a cyclic permutation of the matrix columns.

◆ transpose()

FaMat33 FaMat33::transpose ( ) const

Returns the transpose of matrix.

Friends And Related Function Documentation

◆ operator!=

int operator!= ( const FaMat33 &  a,
const FaMat33 &  b 
)
friend

Inequality operator.

◆ operator* [1/5]

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

Multiplication of two matrices.

◆ operator* [2/5]

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

Multiplication of a matrix and a point vector.

◆ operator* [3/5]

FaMat33 operator* ( const FaMat33 &  a,
double  d 
)
friend

Scaling operator, multiplication of a matrix and a scalar.

◆ operator* [4/5]

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

Multiplication of a point vector and matrix.

◆ operator* [5/5]

FaMat33 operator* ( double  d,
const FaMat33 &  a 
)
friend

Scaling operator, multiplication of a scalar and a matrix.

◆ operator+

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

Global addition operator.

◆ operator- [1/2]

FaMat33 operator- ( const FaMat33 &  a)
friend

Unary negation operator.

◆ operator- [2/2]

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

Global subtraction operator.

◆ operator/

FaMat33 operator/ ( const FaMat33 &  a,
double  d 
)
friend

Scaling operator, division by a scalar.

◆ operator<<

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

Printing operator.

◆ operator==

int operator== ( const FaMat33 &  a,
const FaMat33 &  b 
)
friend

Equality operator.

◆ operator>>

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

Reading operator.

Member Data Documentation

◆ v

FaVec3 FaMat33::v[3]
private

Columns of the 3×3 matrix.


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