TriangleSetTopologyAlgorithms.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_TOPOLOGY_TRIANGLESETTOPOLOGYALGORITHMS_H
00026 #define SOFA_COMPONENT_TOPOLOGY_TRIANGLESETTOPOLOGYALGORITHMS_H
00027 
00028 #include <sofa/component/topology/EdgeSetTopologyAlgorithms.h>  
00029 
00030 namespace sofa
00031 {
00032 namespace component
00033 {
00034 namespace topology
00035 {
00036     class TriangleSetTopologyContainer;
00037 
00038     class TriangleSetTopologyModifier;
00039 
00040     template < class DataTypes >
00041     class TriangleSetGeometryAlgorithms;
00042 
00043     using core::componentmodel::topology::BaseMeshTopology;
00044     typedef BaseMeshTopology::TriangleID TriangleID;
00045     typedef BaseMeshTopology::Triangle Triangle;
00046     typedef BaseMeshTopology::SeqTriangles SeqTriangles;
00047     typedef BaseMeshTopology::VertexTriangles VertexTriangles;
00048     typedef BaseMeshTopology::EdgeTriangles EdgeTriangles;
00049     typedef BaseMeshTopology::TriangleEdges TriangleEdges;
00050     
00054     template < class DataTypes >
00055     class TriangleSetTopologyAlgorithms : public EdgeSetTopologyAlgorithms<DataTypes> 
00056     {
00057     public:
00058         typedef typename DataTypes::VecCoord VecCoord;
00059         typedef typename DataTypes::Real Real;
00060         typedef typename DataTypes::Coord Coord;
00061 
00062         TriangleSetTopologyAlgorithms()
00063         :EdgeSetTopologyAlgorithms<DataTypes>()
00064         {}
00065 
00066         virtual ~TriangleSetTopologyAlgorithms() {}
00067 
00068         virtual void init();
00069                     
00072         bool Suture2Points(unsigned int ind_ta, unsigned int ind_tb, unsigned int &ind1, unsigned int &ind2);
00073 
00076         bool InciseAlongPointsList(bool is_first_cut, 
00077                                 const sofa::defaulttype::Vec<3,double>& a, 
00078                                 const sofa::defaulttype::Vec<3,double>& b, 
00079                                 const unsigned int ind_ta, const unsigned int ind_tb, 
00080                                 unsigned int& a_last, sofa::helper::vector< unsigned int > &a_p12_last, 
00081                                 sofa::helper::vector< unsigned int > &a_i123_last,
00082                                 unsigned int& b_last, sofa::helper::vector< unsigned int > &b_p12_last, 
00083                                 sofa::helper::vector< unsigned int > &b_i123_last,
00084                                 sofa::helper::vector< sofa::helper::vector<unsigned int> > &new_points, 
00085                                 sofa::helper::vector< sofa::helper::vector<unsigned int> > &closest_vertices);
00086 
00089         void RemoveAlongTrianglesList(const sofa::defaulttype::Vec<3,double>& a, 
00090                                     const sofa::defaulttype::Vec<3,double>& b, 
00091                                     const unsigned int ind_ta, const unsigned int ind_tb);
00092 
00095         void InciseAlongLinesList(const sofa::helper::vector< sofa::defaulttype::Vec<3,double> >& input_points, 
00096                                 const sofa::helper::vector< unsigned int > &input_triangles);
00097                 
00101         virtual int InciseAlongEdge(unsigned int edge);
00102             
00103     private:
00104         TriangleSetTopologyContainer*                   m_container;
00105         TriangleSetTopologyModifier*                    m_modifier;
00106         TriangleSetGeometryAlgorithms< DataTypes >*     m_geometryAlgorithms;
00107       };
00108 
00109 } // namespace topology
00110 
00111 } // namespace component
00112 
00113 } // namespace sofa
00114 
00115 #endif

Generated on Sun Nov 23 03:47:40 2008 for Sofa by  doxygen 1.5.7.1