TopologicalChangeManager.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                               SOFA :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
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 } // namespace collision
00104 
00105 } // namespace component
00106 
00107 } // namespace sofa
00108 
00109 #endif

Generated on Sun Nov 23 02:36:39 2008 for Sofa by  doxygen 1.5.7.1