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_TOPOLOGY_POINTSETGEOMETRYALGORITHMS_H 00026 #define SOFA_COMPONENT_TOPOLOGY_POINTSETGEOMETRYALGORITHMS_H 00027 00028 #include <sofa/core/componentmodel/topology/BaseTopology.h> 00029 #include <sofa/core/componentmodel/topology/BaseMeshTopology.h> 00030 00031 namespace sofa 00032 { 00033 namespace core { namespace componentmodel { namespace behavior { 00034 template <class DataTypes> 00035 class MechanicalState; 00036 }}} 00037 00038 namespace component 00039 { 00040 00041 namespace topology 00042 { 00043 using core::componentmodel::topology::BaseMeshTopology; 00044 using core::componentmodel::behavior::MechanicalState; 00045 typedef BaseMeshTopology::PointID PointID; 00046 00050 template<class DataTypes> 00051 class PointSetGeometryAlgorithms : public core::componentmodel::topology::GeometryAlgorithms 00052 { 00053 public: 00054 typedef typename DataTypes::Real Real; 00055 typedef typename DataTypes::Coord Coord; 00056 typedef typename DataTypes::VecCoord VecCoord; 00057 00058 PointSetGeometryAlgorithms() 00059 : GeometryAlgorithms() 00060 {} 00061 00062 virtual ~PointSetGeometryAlgorithms() {} 00063 00064 virtual void init(); 00065 00067 Coord getPointSetCenter() const; 00068 00070 void getEnclosingSphere(Coord ¢er, Real &radius) const; 00071 00074 void getAABB(Real bb[6]) const; 00075 00077 sofa::core::componentmodel::behavior::MechanicalState<DataTypes> *getDOF() const { return object; } 00078 00079 virtual std::string getTemplateName() const 00080 { 00081 return templateName(this); 00082 } 00083 00084 static std::string templateName(const PointSetGeometryAlgorithms<DataTypes>* = NULL) 00085 { 00086 return DataTypes::Name(); 00087 } 00088 protected: 00090 sofa::core::componentmodel::behavior::MechanicalState<DataTypes> *object; 00091 sofa::core::componentmodel::topology::BaseMeshTopology* m_topology; 00092 }; 00093 00094 } // namespace topology 00095 00096 } // namespace component 00097 00098 } // namespace sofa 00099 00100 #endif // SOFA_COMPONENTS_POINTSETGEOMETRYALGORITHMS_H
1.5.7.1