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
00026 #ifndef OPENMESH_TRICONNECTIVITY_HH
00027 #define OPENMESH_TRICONNECTIVITY_HH
00028
00029 #include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
00030
00031 namespace OpenMesh {
00032
00033 class TriConnectivity : public PolyConnectivity
00034 {
00035 public:
00036
00037 TriConnectivity() {}
00038 virtual ~TriConnectivity() {}
00039
00040 inline static bool is_triangles()
00041 { return true; }
00042
00046 inline void assign_connectivity(const TriConnectivity& _other)
00047 { PolyConnectivity::assign_connectivity(_other); }
00048
00049 inline void assign_connectivity(const PolyConnectivity& _other)
00050 {
00051 PolyConnectivity::assign_connectivity(_other);
00052 triangulate();
00053 }
00054
00061 FaceHandle add_face(const std::vector<VertexHandle>& _vhandles)
00062 { return add_face(&_vhandles.front(), _vhandles.size()); }
00063
00064 FaceHandle add_face(const VertexHandle* _vhandles, uint _vhs_size);
00065
00066 FaceHandle add_face(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2)
00067 {
00068 VertexHandle vhs[3] = { _vh0, _vh1, _vh2 };
00069 return PolyConnectivity::add_face(vhs, 3);
00070 }
00071
00073
00077 inline VertexHandle opposite_vh(HalfedgeHandle _heh) const
00078 {
00079 return is_boundary(_heh) ? InvalidVertexHandle :
00080 to_vertex_handle(next_halfedge_handle(_heh));
00081 }
00082
00086 VertexHandle opposite_he_opposite_vh(HalfedgeHandle _heh) const
00087 { return opposite_vh(opposite_halfedge_handle(_heh)); }
00088
00092
00093
00098 bool is_collapse_ok(HalfedgeHandle _heh);
00099
00101 HalfedgeHandle vertex_split(VertexHandle v0, VertexHandle v1,
00102 VertexHandle vl, VertexHandle vr);
00103
00105 bool is_flip_ok(EdgeHandle _eh) const;
00106
00109 void flip(EdgeHandle _eh);
00110
00112 void split(EdgeHandle _eh, VertexHandle _vh);
00113
00115 inline void split(FaceHandle _fh, VertexHandle _vh)
00116 { PolyConnectivity::split(_fh, _vh); }
00117
00119
00120 private:
00122 HalfedgeHandle insert_loop(HalfedgeHandle _hh);
00124 HalfedgeHandle insert_edge(VertexHandle _vh,
00125 HalfedgeHandle _h0, HalfedgeHandle _h1);
00126 };
00127
00128 }
00129
00130 #endif//OPENMESH_TRICONNECTIVITY_HH