SOFA API  014b24ea
Open source framework for multi-physics simuation
sofa::component::collision::TOBB< TDataTypes > Class Template Reference

#include <OBBModel.h>

Inheritance diagram for sofa::component::collision::TOBB< TDataTypes >:

Detailed Description

template<class TDataTypes>
class sofa::component::collision::TOBB< TDataTypes >

An OBB model is a set of OBBs. It is linked to a rigid mechanical object. Each frame of the rigid machanical object represents the frame of one OBB. So an OBB is represented by its frame which orients it, a center and 3 extents. A point P is inside the OBB obb if and only if P = obb.center() + a*obb.axis(0) + b*obb.axis(1) + c*obb.axis(2) with -obb.extent(0) <= a <= obb.extent(0), -obb.extent(1) <= b <= obb.extent(1), -obb.extent(2) <= c <= obb.extent(2). (obb.axis(i) is the local frame axis for i-th dimension)

Public Member Functions

 TOBB (ParentModel *model, int index)
 
 TOBB (const core::CollisionElementIterator &i)
 
Coord axis (int i) const
 
void axes (Coord *v_axes) const
 
Real extent (int i) const
 
const Coordextents () const
 
const Coordcenter () const
 
const Quaternionorientation () const
 
const Coordv () const
 
Coord localCoordinates (const Coord &c) const
 
Coord generalCoordinates (const Coord &c) const
 
void vertices (std::vector< Coord > &vs) const
 
void showVertices () const
 
bool onSurface (const Coord &p) const
 
- Public Member Functions inherited from sofa::core::TCollisionElementIterator< OBBCollisionModel< TDataTypes > >
 TCollisionElementIterator (Model *model=nullptr, int index=0)
 
 TCollisionElementIterator (Model *model, int index, VIterator it, VIterator itend)
 
 TCollisionElementIterator (Model *model, VIterator it, VIterator itend)
 
bool isActive (core::CollisionModel *cm=nullptr) const
 
bool operator== (const TCollisionElementIterator< Model2 > &i) const
 
bool operator!= (const TCollisionElementIterator< Model2 > &i) const
 
bool valid () const
 
ModelgetCollisionModel () const
 Return the CollisionModel containing the referenced element. More...
 
std::pair< CollisionElementIterator, CollisionElementIteratorgetInternalChildren () const
 
std::pair< CollisionElementIterator, CollisionElementIteratorgetExternalChildren () const
 
bool isLeaf () const
 
bool canCollideWith (TCollisionElementIterator< Model > &elem)
 
double getProximity ()
 Distance to the actual (visual) surface. More...
 
double getContactStiffness ()
 Contact stiffness. More...
 
double getContactFriction ()
 Contact friction (damping) coefficient. More...
 
void draw (const core::visual::VisualParams *vparams)
 
- Public Member Functions inherited from sofa::core::BaseCollisionElementIterator
 BaseCollisionElementIterator (int index=0)
 
 BaseCollisionElementIterator (int index, VIterator it, VIterator itend)
 
 BaseCollisionElementIterator (VIterator it, VIterator itend)
 
void next ()
 Increment this iterator to reference the next element. More...
 
void operator++ ()
 Increment this iterator to reference the next element. More...
 
void operator++ (int)
 Increment this iterator to reference the next element. More...
 
int getIndex () const
 
const VIteratorgetVIterator () const
 Return the current iterator in the vector of indices, in case such a vector is currently used. More...
 
const VIteratorgetVIteratorEnd () const
 Return the end iterator in the vector of indices, in case such a vector is currently used. More...
 

Additional Inherited Members

- Public Attributes inherited from sofa::core::TCollisionElementIterator< OBBCollisionModel< TDataTypes > >
Modelmodel
 CollisionModel containing the referenced element. More...
 
- Protected Attributes inherited from sofa::core::BaseCollisionElementIterator
int index
 index of the referenced element inside the CollisionModel. More...
 
VIterator it
 current position in a vector of indices, in case this iterator traverse a non-contiguous set of indices More...
 
VIterator itend
 end position in a vector of indices, in case this iterator traverse a non-contiguous set of indices More...
 
- Static Protected Attributes inherited from sofa::core::BaseCollisionElementIterator
static std::vector< int > SOFA_CORE_API emptyVector
 empty vector to be able to initialize the iterator to an empty pair More...
 

Constructor details

template<class DataTypes >
sofa::component::collision::TOBB< DataTypes >::TOBB ( ParentModel model,
int  index 
)
inline
template<class DataTypes >
sofa::component::collision::TOBB< DataTypes >::TOBB ( const core::CollisionElementIterator i)
inlineexplicit

Function details

template<class DataTypes >
void sofa::component::collision::TOBB< DataTypes >::axes ( Coord v_axes) const
inline

Fills v_axes of size 3 with the local frame.

template<class DataTypes >
TOBB< DataTypes >::Coord sofa::component::collision::TOBB< DataTypes >::axis ( int  i) const
inline

Returns the axis of the local frame at i-th dimension.

template<class DataTypes >
const TOBB< DataTypes >::Coord & sofa::component::collision::TOBB< DataTypes >::center ( ) const
inline
template<class DataTypes >
TOBB< DataTypes >::Real sofa::component::collision::TOBB< DataTypes >::extent ( int  i) const
inline

Returns the extent at i-th dimension.

template<class DataTypes >
const TOBB< DataTypes >::Coord & sofa::component::collision::TOBB< DataTypes >::extents ( ) const
inline

Returns the 3 extents.

template<class DataTypes >
TOBB< DataTypes >::Coord sofa::component::collision::TOBB< DataTypes >::generalCoordinates ( const Coord c) const
inline

Returns the coordinates of c (in the local frame) in the general coordinate system.

template<class DataTypes >
TOBB< DataTypes >::Coord sofa::component::collision::TOBB< DataTypes >::localCoordinates ( const Coord c) const
inline

Returns the coordinates of c (in general coordinate system) in the local frame.

template<class DataTypes >
bool sofa::component::collision::TOBB< DataTypes >::onSurface ( const Coord p) const
inline
template<class DataTypes >
const TOBB< DataTypes >::Quaternion & sofa::component::collision::TOBB< DataTypes >::orientation ( ) const
inline

Returns the quaterion representing the rotation of the local frame.

template<class DataTypes >
void sofa::component::collision::TOBB< DataTypes >::showVertices ( ) const
inline
template<class DataTypes >
const TOBB< DataTypes >::Coord & sofa::component::collision::TOBB< DataTypes >::v ( ) const
inline

Returns linear velocity.

template<class DataTypes >
void sofa::component::collision::TOBB< DataTypes >::vertices ( std::vector< Coord > &  vs) const
inline

Returns the 8 vertices in vs in general coordinate system. vertex indexation below :

                                     7--------6
                                    /|       /|
                                   3--------2 |
                                   | |      | |
                                   | 4------|-5
                                   |/       |/
                                   0--------1