SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::core::TCollisionElementIterator< TModel > Class Template Reference

#include <CollisionElement.h>

Reference to an collision element defined by its index inside a given collision model. More...

Inheritance diagram for sofa::core::TCollisionElementIterator< TModel >:

Detailed Description

template<class TModel>
class sofa::core::TCollisionElementIterator< TModel >

Reference to an collision element defined by its index inside a given collision model.

A CollisionElementIterator is only a temporary iterator and must not contain any data. It only contains inline non-virtual methods calling the appropriate methods in the parent model object. This class is a template in order to store reference to a specific type of element (such as a Cube in a CubeModel).

Public Attributes

Modelmodel
 CollisionModel containing the referenced element. More...
 

Public Member Functions

 TCollisionElementIterator (Model *model=nullptr, index_type index=0)
 
 TCollisionElementIterator (Model *model, index_type index, VIterator it, VIterator itend)
 
 TCollisionElementIterator (Model *model, VIterator it, VIterator itend)
 
bool isActive (core::CollisionModel *cm=nullptr) const
 
Iterator Interface
template<class Model2 >
bool operator== (const TCollisionElementIterator< Model2 > &i) const
 
template<class Model2 >
bool operator!= (const TCollisionElementIterator< Model2 > &i) const
 
bool valid () const
 
ModelgetCollisionModel () const
 Return the CollisionModel containing the referenced element. More...
 
Wrapper methods to access data and methods inside the CollisionModel.
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 (index_type index=0)
 
 BaseCollisionElementIterator (index_type 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...
 
index_type 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

- Protected Attributes inherited from sofa::core::BaseCollisionElementIterator
index_type 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...
 

Attribute details

template<class TModel>
Model* sofa::core::TCollisionElementIterator< TModel >::model

CollisionModel containing the referenced element.

Constructor details

template<class TModel>
sofa::core::TCollisionElementIterator< TModel >::TCollisionElementIterator ( Model model = nullptr,
index_type  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).

template<class TModel>
sofa::core::TCollisionElementIterator< TModel >::TCollisionElementIterator ( Model model,
index_type  index,
VIterator  it,
VIterator  itend 
)
inline

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

template<class TModel>
sofa::core::TCollisionElementIterator< TModel >::TCollisionElementIterator ( Model model,
VIterator  it,
VIterator  itend 
)
inline

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

Function details

template<class TModel>
bool sofa::core::TCollisionElementIterator< TModel >::canCollideWith ( TCollisionElementIterator< Model > &  elem)
inline

Test if this element can collide with another element.

See also
CollisionModel::canCollideWithElement
template<class TModel>
void sofa::core::TCollisionElementIterator< TModel >::draw ( const core::visual::VisualParams vparams)
inline

Render this element.

See also
CollisionModel::draw
template<class TModel>
Model* sofa::core::TCollisionElementIterator< TModel >::getCollisionModel ( ) const
inline

Return the CollisionModel containing the referenced element.

template<class TModel>
double sofa::core::TCollisionElementIterator< TModel >::getContactFriction ( )
inline

Contact friction (damping) coefficient.

template<class TModel>
double sofa::core::TCollisionElementIterator< TModel >::getContactStiffness ( )
inline

Contact stiffness.

template<class Model >
std::pair< CollisionElementIterator, CollisionElementIterator > sofa::core::TCollisionElementIterator< Model >::getExternalChildren ( ) const

Return the list (as a pair of iterators) of external children of this element.

See also
CollisionModel::getExternalChildren
template<class Model >
std::pair< CollisionElementIterator, CollisionElementIterator > sofa::core::TCollisionElementIterator< Model >::getInternalChildren ( ) const

Return the list (as a pair of iterators) of internal children of this element.

See also
CollisionModel::getInternalChildren
template<class TModel>
double sofa::core::TCollisionElementIterator< TModel >::getProximity ( )
inline

Distance to the actual (visual) surface.

template<class CollisionModel >
bool sofa::core::TCollisionElementIterator< CollisionModel >::isActive ( core::CollisionModel cm = nullptr) const
inline
template<class TModel>
bool sofa::core::TCollisionElementIterator< TModel >::isLeaf ( ) const
inline

Test if this element is a leaf.

Returns
true if the element(index) is leaf. i.e. If it is a primitive itself.
template<class TModel>
template<class Model2 >
bool sofa::core::TCollisionElementIterator< TModel >::operator!= ( const TCollisionElementIterator< Model2 > &  i) const
inline

Compare two iterators. Note that even it the iterators are of different types, they can point to the same element.

template<class TModel>
template<class Model2 >
bool sofa::core::TCollisionElementIterator< TModel >::operator== ( const TCollisionElementIterator< Model2 > &  i) const
inline

Compare two iterators. Note that even it the iterators are of different types, they can point to the same element.

template<class TModel>
bool sofa::core::TCollisionElementIterator< TModel >::valid ( ) const
inline

Test if this iterator is initialized with a valid CollisionModel. Note that it does not test if the referenced element inside the CollisionModel is valid.