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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef OPENMESH_TRICONNECTIVITY_HH
00043 #define OPENMESH_TRICONNECTIVITY_HH
00044
00045 #include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
00046
00047 namespace OpenMesh {
00048
00051 class TriConnectivity : public PolyConnectivity
00052 {
00053 public:
00054
00055 TriConnectivity() {}
00056 virtual ~TriConnectivity() {}
00057
00058 inline static bool is_triangles()
00059 { return true; }
00060
00064 inline void assign_connectivity(const TriConnectivity& _other)
00065 { PolyConnectivity::assign_connectivity(_other); }
00066
00067 inline void assign_connectivity(const PolyConnectivity& _other)
00068 {
00069 PolyConnectivity::assign_connectivity(_other);
00070 triangulate();
00071 }
00072
00079 FaceHandle add_face(const std::vector<VertexHandle>& _vhandles)
00080 { return add_face(&_vhandles.front(), _vhandles.size()); }
00081
00082 FaceHandle add_face(const VertexHandle* _vhandles, uint _vhs_size);
00083
00084 FaceHandle add_face(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2)
00085 {
00086 VertexHandle vhs[3] = { _vh0, _vh1, _vh2 };
00087 return PolyConnectivity::add_face(vhs, 3);
00088 }
00089
00091
00095 inline VertexHandle opposite_vh(HalfedgeHandle _heh) const
00096 {
00097 return is_boundary(_heh) ? InvalidVertexHandle :
00098 to_vertex_handle(next_halfedge_handle(_heh));
00099 }
00100
00104 VertexHandle opposite_he_opposite_vh(HalfedgeHandle _heh) const
00105 { return opposite_vh(opposite_halfedge_handle(_heh)); }
00106
00110
00111
00116 bool is_collapse_ok(HalfedgeHandle _heh);
00117
00119 HalfedgeHandle vertex_split(VertexHandle v0, VertexHandle v1,
00120 VertexHandle vl, VertexHandle vr);
00121
00123 bool is_flip_ok(EdgeHandle _eh) const;
00124
00127 void flip(EdgeHandle _eh);
00128
00130 void split(EdgeHandle _eh, VertexHandle _vh);
00131
00133 inline void split(FaceHandle _fh, VertexHandle _vh)
00134 { PolyConnectivity::split(_fh, _vh); }
00135
00137
00138 private:
00140 HalfedgeHandle insert_loop(HalfedgeHandle _hh);
00142 HalfedgeHandle insert_edge(VertexHandle _vh,
00143 HalfedgeHandle _h0, HalfedgeHandle _h1);
00144 };
00145
00146 }
00147
00148 #endif//OPENMESH_TRICONNECTIVITY_HH