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

Class representing an object location in 3D space. This class is used to hold data describing the location (position and orientation) of an object in a Fedem model. The location can be represented in a different ways and the class also contain methods for switching the representation types. More...

#include <FFa3DLocation.H>

Public Types

enum  PosType {
  CART_X_Y_Z , CYL_R_YR_X , CYL_R_ZR_Y , CYL_R_XR_Z ,
  SPH_R_XR_YZ , SPH_R_YR_ZX , SPH_R_ZR_XY
}
 Enum for position representation. More...
 
enum  RotType { EUL_Z_Y_X , PNT_PX_PXY , PNT_PZ_PXZ , DIR_EX_EXY }
 Enum for orientation representation. More...
 

Public Member Functions

 FFa3DLocation ()
 Default constructor. More...
 
 FFa3DLocation (PosType t, const FaVec3 &v0, RotType r, const FaVec3 &v1, const FaVec3 &v2)
 Constructor defining the orientation from two direction vectors. More...
 
 FFa3DLocation (PosType t, const FaVec3 &v0, RotType r, const FaVec3 &v1)
 Constructor defining the orientation from a rotation angles. More...
 
 FFa3DLocation (const FaMat34 &m)
 Constructor defining the location from a position matrix. More...
 
 FFa3DLocation (const FFa3DLocation &m)
 Copy constructor. More...
 
void saveMyNumericalData ()
 Let this instance save its numerical data. More...
 
FFa3DLocation & operator= (const FFa3DLocation &m)
 Assignment operator. More...
 
bool operator== (const FFa3DLocation &m) const
 Comparison operator. More...
 
const FaVec3 & operator[] (int i) const
 Indexing operator, for read access. More...
 
FaVec3 & operator[] (int i)
 Indexing operator, for assignment. More...
 
PosType getPosType () const
 Returns the positioning type. More...
 
RotType getRotType () const
 Returns the orientation type. More...
 
int getNumFields () const
 Returns number of numerical fields for defining the orientation. More...
 
bool changePosType (PosType newType)
 Converts the position representation in *this to newType. More...
 
bool changeRotType (RotType newType)
 Converts the orientation representation in *this to newType. More...
 
FFa3DLocation & changePosRefCS (const FaMat34 &newRef, const FaMat34 &oldRef)
 Changes the position reference CS from oldRef to newRef. More...
 
FFa3DLocation & changeRotRefCS (const FaMat34 &newRef, const FaMat34 &oldRef)
 Changes the orientation reference CS from oldRef to newRef. More...
 
FFa3DLocation & set (PosType p, const FaMat34 &posRelMx, RotType r, const FaMat34 &rotRelMx, const FaMat34 &glbPos)
 Updates the location based on the provided parameters. More...
 
FFa3DLocation & set (PosType p, RotType r, const FaMat34 &glbPos)
 Updates the location based on the provided parameters. More...
 
FFa3DLocation & setPos (PosType p, const FaVec3 &cartPos)
 Updates the position in *this. More...
 
FFa3DLocation & setRot (RotType r, const FaMat33 &rotMat)
 Updates the orientation in *this. More...
 
FaVec3 translation () const
 Returns the cartesian position of *this. More...
 
FaMat33 direction () const
 Returns the orientation of *this as a rotation matrix. More...
 
FaMat34 getMatrix () const
 Returns a FaMat34 representation of *this. More...
 
FaMat34 getMatrix (const FaMat34 &posRelMx, const FaMat34 &rotRelMx) const
 Returns a FaMat34 representation of a relative location. More...
 
bool isValid () const
 Checks that the current data represent a valid location. More...
 
std::ostream & print (std::ostream &s, bool includeNumericalData=true) const
 Prints the content of *this to the provided output stream. More...
 

Private Attributes

PosTypeEnum myPosTyp = CART_X_Y_Z
 Current positioning type. More...
 
RotTypeEnum myRotTyp = EUL_Z_Y_X
 Current orientation type. More...
 
std::array< FaVec3, 3 > myL
 Vectors with position/orientation data. More...
 
bool saveNumericalData = false
 If false, only the type enums are stored. More...
 

Friends

std::ostream & operator<< (std::ostream &s, const FFa3DLocation &m)
 Global printing operator. More...
 
std::istream & operator>> (std::istream &s, FFa3DLocation &m)
 Global reading operator. More...
 

Detailed Description

Class representing an object location in 3D space. This class is used to hold data describing the location (position and orientation) of an object in a Fedem model. The location can be represented in a different ways and the class also contain methods for switching the representation types.

Member Enumeration Documentation

◆ PosType

Enum for position representation.

Enumerator
CART_X_Y_Z 

Cartesian coordinates.

CYL_R_YR_X 

Cylindric coordinates, angle from Y-axis about X-axis.

CYL_R_ZR_Y 

Cylindric coordinates, angle from Z-axis about Y-axis.

CYL_R_XR_Z 

Cylindric coordinates, angle from X-axis about Z-axis.

SPH_R_XR_YZ 

Spherical coordinates, asimuth angle from X-axis.

SPH_R_YR_ZX 

Spherical coordinates, asimuth angle from Y-axis.

SPH_R_ZR_XY 

Spherical coordinates, asimuth angle from Z-axis.

◆ RotType

Enum for orientation representation.

Enumerator
EUL_Z_Y_X 

Euler ZYX-angles. Supposed to be entered [ X, Y, Z].

PNT_PX_PXY 

Point on X-axis and point in XY-plane.

PNT_PZ_PXZ 

Point on Z-axis and point in XZ-plane.

DIR_EX_EXY 

Direction vector along X-axis, direction vector in XY-plane.

Constructor & Destructor Documentation

◆ FFa3DLocation() [1/5]

FFa3DLocation::FFa3DLocation ( )
inline

Default constructor.

◆ FFa3DLocation() [2/5]

FFa3DLocation::FFa3DLocation ( PosType  t,
const FaVec3 &  v0,
RotType  r,
const FaVec3 &  v1,
const FaVec3 &  v2 
)

Constructor defining the orientation from two direction vectors.

◆ FFa3DLocation() [3/5]

FFa3DLocation::FFa3DLocation ( PosType  t,
const FaVec3 &  v0,
RotType  r,
const FaVec3 &  v1 
)

Constructor defining the orientation from a rotation angles.

◆ FFa3DLocation() [4/5]

FFa3DLocation::FFa3DLocation ( const FaMat34 &  m)

Constructor defining the location from a position matrix.

◆ FFa3DLocation() [5/5]

FFa3DLocation::FFa3DLocation ( const FFa3DLocation &  m)
inline

Copy constructor.

Member Function Documentation

◆ changePosRefCS()

FFa3DLocation & FFa3DLocation::changePosRefCS ( const FaMat34 &  newRef,
const FaMat34 &  oldRef 
)

Changes the position reference CS from oldRef to newRef.

This is a convenience method which changes the imaginary reference coordinate system for the position values stored in *this to newRef from oldRef.

◆ changePosType()

bool FFa3DLocation::changePosType ( PosType  newType)

Converts the position representation in *this to newType.

◆ changeRotRefCS()

FFa3DLocation & FFa3DLocation::changeRotRefCS ( const FaMat34 &  newRef,
const FaMat34 &  oldRef 
)

Changes the orientation reference CS from oldRef to newRef.

This is a convenience method which changes the imaginary reference coordinate system for the orientation values stored in *this to newRef from oldRef.

◆ changeRotType()

bool FFa3DLocation::changeRotType ( RotType  newType)

Converts the orientation representation in *this to newType.

◆ direction()

FaMat33 FFa3DLocation::direction ( ) const

Returns the orientation of *this as a rotation matrix.

◆ getMatrix() [1/2]

FaMat34 FFa3DLocation::getMatrix ( ) const

Returns a FaMat34 representation of *this.

◆ getMatrix() [2/2]

FaMat34 FFa3DLocation::getMatrix ( const FaMat34 &  posRelMx,
const FaMat34 &  rotRelMx 
) const

Returns a FaMat34 representation of a relative location.

This is a utility method returning a FaMat34 object that represents the global position of *this as if it was placed relative to the two matrices provided.

return FaMat34( rotRelMx * this->direction(), posRelMx * this->translation() )

◆ getNumFields()

int FFa3DLocation::getNumFields ( ) const
inline

Returns number of numerical fields for defining the orientation.

◆ getPosType()

PosType FFa3DLocation::getPosType ( ) const
inline

Returns the positioning type.

◆ getRotType()

RotType FFa3DLocation::getRotType ( ) const
inline

Returns the orientation type.

◆ isValid()

bool FFa3DLocation::isValid ( ) const

Checks that the current data represent a valid location.

◆ operator=()

FFa3DLocation & FFa3DLocation::operator= ( const FFa3DLocation &  m)

Assignment operator.

◆ operator==()

bool FFa3DLocation::operator== ( const FFa3DLocation &  m) const

Comparison operator.

◆ operator[]() [1/2]

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

Indexing operator, for assignment.

◆ operator[]() [2/2]

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

Indexing operator, for read access.

◆ print()

std::ostream & FFa3DLocation::print ( std::ostream &  s,
bool  includeNumericalData = true 
) const

Prints the content of *this to the provided output stream.

◆ saveMyNumericalData()

void FFa3DLocation::saveMyNumericalData ( )
inline

Let this instance save its numerical data.

◆ set() [1/2]

FFa3DLocation & FFa3DLocation::set ( PosType  p,
const FaMat34 &  posRelMx,
RotType  r,
const FaMat34 &  rotRelMx,
const FaMat34 &  globalPosition 
)

Updates the location based on the provided parameters.

This method sets *this to contain the position of globalPosition relative to posRelMx stored as type p, and the orientation of globalPosition relative to rotRelMx stored as type r.

◆ set() [2/2]

FFa3DLocation & FFa3DLocation::set ( PosType  p,
RotType  r,
const FaMat34 &  mx 
)

Updates the location based on the provided parameters.

This method sets *this to be positioned and oriented as the provided matrix mx, converting it to the provided storage types p and r.

◆ setPos()

FFa3DLocation & FFa3DLocation::setPos ( PosType  p,
const FaVec3 &  cartPos 
)

Updates the position in *this.

This method sets the position in *this to the provided cartesian position cartPos, converting it to position type p way of storing it.

◆ setRot()

FFa3DLocation & FFa3DLocation::setRot ( RotType  r,
const FaMat33 &  rotMat 
)

Updates the orientation in *this.

This method sets the orientation in *this to the provided rotation matrix rotMat, converting it to orientation type r way of storing it. When needed, the current position is fetched by calling translation().

◆ translation()

FaVec3 FFa3DLocation::translation ( ) const

Returns the cartesian position of *this.

Friends And Related Function Documentation

◆ operator<<

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

Global printing operator.

◆ operator>>

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

Global reading operator.

Member Data Documentation

◆ myL

std::array<FaVec3,3> FFa3DLocation::myL
private

Vectors with position/orientation data.

◆ myPosTyp

PosTypeEnum FFa3DLocation::myPosTyp = CART_X_Y_Z
private

Current positioning type.

◆ myRotTyp

RotTypeEnum FFa3DLocation::myRotTyp = EUL_Z_Y_X
private

Current orientation type.

◆ saveNumericalData

bool FFa3DLocation::saveNumericalData = false
private

If false, only the type enums are stored.


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