TriangleSetTopologyAlgorithms.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 #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 }
00110
00111 }
00112
00113 }
00114
00115 #endif