TopologicalChangeManager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SOFA_COMPONENT_COLLISION_TOPOLOGICALCHANGEMANAGER_H
00027 #define SOFA_COMPONENT_COLLISION_TOPOLOGICALCHANGEMANAGER_H
00028
00029 #include <sofa/core/CollisionElement.h>
00030
00031 #include <sofa/core/BehaviorModel.h>
00032
00033
00034 #include <sofa/defaulttype/Vec.h>
00035 #include <sofa/defaulttype/Vec3Types.h>
00036
00037 #include <sofa/component/MechanicalObject.h>
00038 #include <sofa/simulation/tree/GNode.h>
00039
00042 namespace sofa
00043 {
00044
00045 namespace component
00046 {
00047 namespace collision{
00048 class TriangleSetModel;
00049 }
00050 }
00051
00052 namespace component
00053 {
00054
00055 namespace collision
00056 {
00057 using namespace sofa::defaulttype;
00058
00059 class TopologicalChangeManager
00060 {
00061 public:
00062 TopologicalChangeManager();
00063 ~TopologicalChangeManager();
00064
00066 void removeItemsFromCollisionModel(sofa::core::CollisionElementIterator) const;
00068 bool incisionCollisionModel(sofa::core::CollisionElementIterator, Vector3&, bool, bool);
00069
00070 protected:
00071
00072 private:
00073 bool incisionTriangleModel(sofa::core::CollisionElementIterator, Vector3&, bool, bool);
00075 bool incisionTriangleSetTopology(sofa::core::componentmodel::topology::BaseMeshTopology*);
00076 bool incisionTriangleSetTopology(sofa::core::CollisionElementIterator, Vector3&, bool, bool, sofa::core::componentmodel::topology::BaseMeshTopology*);
00077
00078 void removeItemsFromTriangleModel(sofa::core::CollisionElementIterator) const;
00079 void removeItemsFromTriangleSetModel(sofa::core::CollisionElementIterator) const;
00080 void removeItemsFromTriangleMeshModel(sofa::core::CollisionElementIterator) const;
00081
00082 private:
00084 struct Incision{
00085 Vec<3,double> a_init;
00086 Vec<3,double> b_init;
00087 unsigned int ind_ta_init;
00088 unsigned int ind_tb_init;
00089
00090 bool is_first_cut;
00091
00092 unsigned int b_last_init;
00093 sofa::helper::vector< unsigned int > b_p12_last_init;
00094 sofa::helper::vector< unsigned int > b_i123_last_init;
00095
00096 unsigned int a_last_init;
00097 sofa::helper::vector< unsigned int > a_p12_last_init;
00098 sofa::helper::vector< unsigned int > a_i123_last_init;
00099
00100 } incision;
00101 };
00102
00103 }
00104
00105 }
00106
00107 }
00108
00109 #endif