SOFA API  cba138a4
Open source framework for multi-physics simuation
sofa::core::CollisionElementIterator Class Reference

#include <CollisionElement.h>

Reference to an abstract collision element. More...

Inheritance diagram for sofa::core::CollisionElementIterator:

Detailed Description

Reference to an abstract collision element.

You can think of a CollisionElementIterator as a glorified pointer to a collision element. It is only there to create a reference to it, not to actual contain its data. Classes derived from TCollisionElementIterator does not store any data, but just provide methods allowing to access the additionnal data stored inside the derived CollisionModel. For instance, the Cube class adds the minVect() / maxVect() methods to retrieve the corners of the cube, however this data is not stored inside Cube, instead it is stored inside the CubeData class within CubeModel.

Public Member Functions

 CollisionElementIterator (CollisionModel *model=nullptr, int index=0)
 
 CollisionElementIterator (CollisionModel *model, VIterator it, VIterator itend)
 
 CollisionElementIterator (CollisionModel *model, int index, VIterator it, VIterator itend)
 
template<class DerivedModel >
 CollisionElementIterator (const TCollisionElementIterator< DerivedModel > &i)
 Automatic conversion from a reference to an element in a derived model. More...
 
template<class DerivedModel >
void operator= (const TCollisionElementIterator< DerivedModel > &i)
 Automatic conversion from a reference to an element in a derived model. More...
 
- Public Member Functions inherited from sofa::core::TCollisionElementIterator< CollisionModel >
 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< CollisionModel >
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

sofa::core::CollisionElementIterator::CollisionElementIterator ( CollisionModel model = nullptr,
int  index = 0 
)
inline

Constructor. In most cases it will be used by the CollisionModel to create interators to its elements (such as in the begin() and end() methods).

sofa::core::CollisionElementIterator::CollisionElementIterator ( CollisionModel model,
VIterator  it,
VIterator  itend 
)
inline

Constructor. This constructor should be used in case a vector of indices is used.

sofa::core::CollisionElementIterator::CollisionElementIterator ( CollisionModel model,
int  index,
VIterator  it,
VIterator  itend 
)
inline

Constructor. This constructor should be used in case a vector of indices is used.

template<class DerivedModel >
sofa::core::CollisionElementIterator::CollisionElementIterator ( const TCollisionElementIterator< DerivedModel > &  i)
inline

Automatic conversion from a reference to an element in a derived model.

Function details

template<class DerivedModel >
void sofa::core::CollisionElementIterator::operator= ( const TCollisionElementIterator< DerivedModel > &  i)
inline

Automatic conversion from a reference to an element in a derived model.