SOFA API  d36dcf8a
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 index=0)
 
 TCollisionElementIterator (Model *model, Index 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
 
TCollisionElementIteratoroperator+= (int n)
 
TCollisionElementIterator operator+ (int n) 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 (const TCollisionElementIterator< Model > &elem) const
 
SReal getProximity () const
 Distance to the actual (visual) surface. More...
 
SReal getContactStiffness () const
 Contact stiffness. More...
 
SReal getContactFriction () const
 Contact friction (damping) coefficient. More...
 
void draw (const core::visual::VisualParams *vparams)
 
- Public Member Functions inherited from sofa::core::BaseCollisionElementIterator
 BaseCollisionElementIterator (Index index=0)
 
 BaseCollisionElementIterator (Index index, VIterator it, VIterator itend)
 
 BaseCollisionElementIterator (VIterator it, VIterator itend)
 
void next ()
 Increment this iterator to reference the next element. More...
 
BaseCollisionElementIteratoroperator++ ()
 Prefix increment this iterator to reference the next element. More...
 
BaseCollisionElementIterator operator++ (int)
 Postfix increment this iterator to reference the next element. More...
 
BaseCollisionElementIteratoroperator+= (int n)
 
BaseCollisionElementIterator operator+ (int n) const
 
Index 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 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

◆ model

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

CollisionModel containing the referenced element.

Constructor details

◆ TCollisionElementIterator() [1/3]

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

◆ TCollisionElementIterator() [2/3]

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

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

◆ TCollisionElementIterator() [3/3]

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

◆ canCollideWith()

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

Test if this element can collide with another element.

See also
CollisionModel::canCollideWithElement

◆ draw()

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

Render this element.

See also
CollisionModel::draw

◆ getCollisionModel()

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

Return the CollisionModel containing the referenced element.

◆ getContactFriction()

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

Contact friction (damping) coefficient.

◆ getContactStiffness()

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

Contact stiffness.

◆ getExternalChildren()

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

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

See also
CollisionModel::getExternalChildren

◆ getInternalChildren()

template<class Model >
std::pair< CollisionElementIterator, CollisionElementIterator > sofa::core::TCollisionElementIterator< Model >::getInternalChildren

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

See also
CollisionModel::getInternalChildren

◆ getProximity()

template<class TModel >
SReal sofa::core::TCollisionElementIterator< TModel >::getProximity ( ) const
inline

Distance to the actual (visual) surface.

◆ isActive()

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

◆ isLeaf()

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.

◆ operator!=()

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.

◆ operator+()

template<class TModel >
TCollisionElementIterator sofa::core::TCollisionElementIterator< TModel >::operator+ ( int  n) const
inline

◆ operator+=()

template<class TModel >
TCollisionElementIterator& sofa::core::TCollisionElementIterator< TModel >::operator+= ( int  n)
inline

◆ operator==()

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.

◆ valid()

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.