SOFA API  38ecbea1
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, Index index=0)
 
 CollisionElementIterator (CollisionModel *model, VIterator it, VIterator itend)
 
 CollisionElementIterator (CollisionModel *model, Index 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, 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
 
bool operator== (const TCollisionElementIterator< Model2 > &i) const
 
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...
 
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

- Public Attributes inherited from sofa::core::TCollisionElementIterator< CollisionModel >
Modelmodel
 CollisionModel containing the referenced element. More...
 
- 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...
 

Constructor details

◆ CollisionElementIterator() [1/4]

sofa::core::CollisionElementIterator::CollisionElementIterator ( CollisionModel 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).

◆ CollisionElementIterator() [2/4]

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.

◆ CollisionElementIterator() [3/4]

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

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

◆ CollisionElementIterator() [4/4]

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

◆ operator=()

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.