CarvingManager.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 #ifndef SOFA_COMPONENT_COLLISION_CARVINGMANAGER_H
00026 #define SOFA_COMPONENT_COLLISION_CARVINGMANAGER_H
00027 
00028 #include <sofa/core/componentmodel/behavior/MechanicalState.h>
00029 #include <sofa/core/componentmodel/collision/Intersection.h>
00030 #include <sofa/core/componentmodel/collision/NarrowPhaseDetection.h>
00031 #include <sofa/component/collision/SphereModel.h>
00032 #include <sofa/component/collision/TriangleModel.h>
00033 #include <sofa/component/topology/PointSubset.h>
00034 #include <sofa/core/objectmodel/BaseObject.h>
00035 #include <sofa/core/objectmodel/Event.h>
00036 
00037 #include <sofa/core/componentmodel/behavior/BaseController.h>
00038 
00039 #include <fstream>
00040 
00041 #include <sofa/component/topology/TetrahedronSetTopologyModifier.h>
00042 
00043 namespace sofa
00044 {
00045 
00046 namespace component
00047 {
00048 
00049 namespace collision
00050 {
00051 
00052 class CarvingManager : public core::componentmodel::behavior::BaseController
00053 {
00054 public:
00055     typedef TriangleModel::DataTypes DataTypes;
00056     typedef DataTypes::Coord Coord;
00057     typedef DataTypes::Real Real;
00058     
00059     typedef SphereModel ToolModel;
00060     typedef helper::vector<core::componentmodel::collision::DetectionOutput> ContactVector;
00061 
00062     Data < std::string > f_modelTool;
00063     Data < std::string > f_modelSurface;
00064     Data < Real > f_minDistance;
00065     Data < Real > f_maxDistance;
00066     Data < Real > f_edgeDistance;
00067     
00068     Data < bool > active;
00069     Data < char > keyEvent;
00070     Data < char > keySwitchEvent;
00071 
00072     sofa::core::componentmodel::topology::BaseMeshTopology* _topology;
00073     sofa::component::topology::TetrahedronSetTopologyModifier* tetraMod; 
00074 
00075 protected:
00076     ToolModel* modelTool;
00077     TriangleModel* modelSurface;
00078     sofa::core::componentmodel::topology::TopologicalMapping * topoMapping;
00079     core::componentmodel::collision::Intersection* intersectionMethod;
00080     core::componentmodel::collision::NarrowPhaseDetection* detectionNP;
00081 
00082 public:
00083     CarvingManager();
00084 
00085     virtual ~CarvingManager();
00086 
00087     virtual void init();
00088 
00089     virtual void reset();
00090     
00091     virtual void handleEvent(sofa::core::objectmodel::Event* event);
00092     
00093     virtual void doCarve();
00094 
00095 };
00096 
00097 } // namespace collision
00098 
00099 } // namespace component
00100 
00101 } // namespace sofa
00102 
00103 #endif

Generated on Sun Nov 23 02:33:11 2008 for Sofa by  doxygen 1.5.7.1