#include <SphereTreeModel.h>


Public Types | |
| typedef component::MechanicalObject < Vec3Types > | Inherit |
| typedef Vec3Types | InDataTypes |
| typedef Vec3Types | DataTypes |
| typedef SingleSphere | Element |
Public Member Functions | |
| SphereTreeModel (double radius=1.0) | |
| Constructor. | |
| int | addSphere (const Vector3 &pos, SReal radius) |
| Add a new sphere to the tree. | |
| void | setSphere (int index, const Vector3 &pos, SReal radius) |
| bool | load (const char *filename) |
| Load SphereTree Model. | |
| void | applyScale (const double s) |
| Scale the current state. | |
| sofa::core::componentmodel::behavior::MechanicalState < InDataTypes > * | getMechanicalState () |
| int | getSize () const |
| Get the number of elements. | |
| virtual void | resize (int size) |
| Set the number of elements. | |
| virtual void | computeBoundingTree (int maxDepth=0) |
| It updates the hierarchical bounding tree. | |
| virtual std::pair < core::CollisionElementIterator, core::CollisionElementIterator > | getInternalChildren (int index) const |
| Returns a pair of iterators. | |
| virtual void | computeContinuousBoundingTree (double dt, int maxDepth=0) |
| To do. | |
| void | draw (int index) |
| Render an collision element. | |
| bool | loadSphereTree (const char *fileName) |
| Load sphere tree given a filename. | |
| virtual bool | isLeaf (int index) const |
| It returns true is the element iterator is a leaf of the spheretree collision model. | |
| void | draw () |
| Render the whole collision model. | |
Data Fields | |
| DataTypes::VecCoord | VecCoord |
| Container of Coord values with the same API as sofa::helper::vector. | |
| int | levels |
| Levels of the tree of the collision model. | |
| int | degree |
| Branching factor of the KTree (number of children for each node). | |
Protected Attributes | |
| sofa::helper::vector< double > | radius |
| vector of radii of spheres in the model | |
| Data< double > | defaultRadius |
| default radius | |
Friends | |
| class | SingleSphere |
Tools can be found at http://isg.cs.tcd.ie/spheretree/ . If you manage to integrate an automatic generation tool to provide .sph files from .obj, don't hesitate to share it to the Sofa's comunity.
Definition at line 99 of file SphereTreeModel.h.
Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.
Definition at line 104 of file SphereTreeModel.h.
Definition at line 105 of file SphereTreeModel.h.
Definition at line 103 of file SphereTreeModel.h.
Definition at line 102 of file SphereTreeModel.h.
| sofa::component::collision::SphereTreeModel::SphereTreeModel | ( | double | radius = 1.0 |
) |
Add a new sphere to the tree.
It actually increases the size of the DOF's of the model setting the radius and the center
Definition at line 82 of file SphereTreeModel.cpp.
References resize(), setSphere(), and sofa::core::CollisionModel::size.
| void sofa::component::collision::SphereTreeModel::applyScale | ( | const double | s | ) | [virtual] |
Scale the current state.
Reimplemented from sofa::component::MechanicalObject< DataTypes >.
Definition at line 208 of file SphereTreeModel.cpp.
References sofa::component::MechanicalObject< DataTypes >::applyScale(), radius, and sofa::core::CollisionModel::size.
| void sofa::component::collision::SphereTreeModel::computeBoundingTree | ( | int | maxDepth = 0 |
) | [virtual] |
It updates the hierarchical bounding tree.
Implements sofa::core::CollisionModel.
Definition at line 274 of file SphereTreeModel.cpp.
| void sofa::component::collision::SphereTreeModel::computeContinuousBoundingTree | ( | double | dt, | |
| int | maxDepth = 0 | |||
| ) | [virtual] |
To do.
Reimplemented from sofa::core::CollisionModel.
Definition at line 281 of file SphereTreeModel.cpp.
| void sofa::component::collision::SphereTreeModel::draw | ( | ) | [virtual] |
Render the whole collision model.
Reimplemented from sofa::core::CollisionModel.
Definition at line 226 of file SphereTreeModel.cpp.
References sofa::core::CollisionModel::color, degree, sofa::core::CollisionModel::draw(), sofa::component::MechanicalObject< DataTypes >::f, sofa::core::objectmodel::BaseObject::getContext(), sofa::core::CollisionModel::getPrevious(), sofa::core::CollisionModel::isActive(), sofa::core::CollisionModel::isSimulated(), and levels.
| void sofa::component::collision::SphereTreeModel::draw | ( | int | ) | [virtual] |
Render an collision element.
Reimplemented from sofa::core::CollisionModel.
Definition at line 217 of file SphereTreeModel.cpp.
References sofa::component::MechanicalObject< DataTypes >::getX(), and radius.
| std::pair< core::CollisionElementIterator, core::CollisionElementIterator > sofa::component::collision::SphereTreeModel::getInternalChildren | ( | int | index | ) | const [virtual] |
Returns a pair of iterators.
The first corresponds to the first child of iterator given by the index. The second element of the pair corresponds to the last children of collisionElementIterator index
Reimplemented from sofa::core::CollisionModel.
Definition at line 286 of file SphereTreeModel.cpp.
References degree, and sofa::core::CollisionModel::size.
| sofa::core::componentmodel::behavior::MechanicalState<InDataTypes>* sofa::component::collision::SphereTreeModel::getMechanicalState | ( | ) | [inline] |
Definition at line 125 of file SphereTreeModel.h.
| int sofa::component::collision::SphereTreeModel::getSize | ( | ) | const [inline] |
Get the number of elements.
Reimplemented from sofa::core::CollisionModel.
Definition at line 130 of file SphereTreeModel.h.
References sofa::component::MechanicalObject< DataTypes >::getSize().
It returns true is the element iterator is a leaf of the spheretree collision model.
Reimplemented from sofa::core::CollisionModel.
Definition at line 297 of file SphereTreeModel.cpp.
References degree, and sofa::core::CollisionModel::size.
Referenced by loadSphereTree().
| bool sofa::component::collision::SphereTreeModel::load | ( | const char * | filename | ) | [virtual] |
Load SphereTree Model.
The file is generated offline using a medial axis approximation Windows executables to obtain the file are available at cesarmendoza_serrano@yahoo.fr
Reimplemented from sofa::component::MechanicalObject< DataTypes >.
Definition at line 97 of file SphereTreeModel.cpp.
References loadSphereTree(), and resize().
| bool sofa::component::collision::SphereTreeModel::loadSphereTree | ( | const char * | fileName | ) |
Load sphere tree given a filename.
To obtain executables (win32) to obtain this sphere tree files hierarchies, please email: cesarmendoza_serrano@yahoo.fr
Definition at line 103 of file SphereTreeModel.cpp.
References sofa::core::CollisionModel::begin(), sofa::helper::system::DataRepository, degree, sofa::core::CollisionModel::end(), isLeaf(), levels, radius, resize(), sofa::component::collision::SingleSphere::setCenter(), and sofa::component::MechanicalObject< DataTypes >::x.
Referenced by load().
| void sofa::component::collision::SphereTreeModel::resize | ( | int | s | ) | [virtual] |
Set the number of elements.
Reimplemented from sofa::core::CollisionModel.
Definition at line 64 of file SphereTreeModel.cpp.
References defaultRadius, sofa::core::objectmodel::Data< T >::getValue(), and radius.
Referenced by addSphere(), load(), and loadSphereTree().
| void sofa::component::collision::SphereTreeModel::setSphere | ( | int | index, | |
| const Vector3 & | pos, | |||
| SReal | radius | |||
| ) |
Definition at line 90 of file SphereTreeModel.cpp.
References sofa::component::MechanicalObject< DataTypes >::getX(), radius, and sofa::core::CollisionModel::size.
Referenced by addSphere().
friend class SingleSphere [friend] |
Definition at line 106 of file SphereTreeModel.h.
Data<double> sofa::component::collision::SphereTreeModel::defaultRadius [protected] |
Branching factor of the KTree (number of children for each node).
Definition at line 152 of file SphereTreeModel.h.
Referenced by draw(), getInternalChildren(), isLeaf(), and loadSphereTree().
Levels of the tree of the collision model.
Definition at line 149 of file SphereTreeModel.h.
Referenced by draw(), and loadSphereTree().
sofa::helper::vector<double> sofa::component::collision::SphereTreeModel::radius [protected] |
vector of radii of spheres in the model
Definition at line 166 of file SphereTreeModel.h.
Referenced by applyScale(), draw(), loadSphereTree(), resize(), and setSphere().
Container of Coord values with the same API as sofa::helper::vector.
Reimplemented from sofa::component::MechanicalObject< DataTypes >.
Definition at line 107 of file SphereTreeModel.h.
1.5.7.1