OpenMesh: OpenMesh/Core/Mesh/TriConnectivity.hh Source File

| OpenMesh

TriConnectivity.hh
1 /* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2022, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42
43
44 #ifndef OPENMESH_TRICONNECTIVITY_HH
45 #define OPENMESH_TRICONNECTIVITY_HH
46
47 #include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
48
49 namespace OpenMesh {
50
53 class OPENMESHDLLEXPORT TriConnectivity : public PolyConnectivity
54 {
55 public:
56
57 TriConnectivity() {}
58 virtual ~TriConnectivity() {}
59
60 inline static bool is_triangles()
61 { return true; }
62
66 inline void assign_connectivity(const TriConnectivity& _other)
67 { PolyConnectivity::assign_connectivity(_other); }
68
69 inline void assign_connectivity(const PolyConnectivity& _other)
70 {
71 PolyConnectivity::assign_connectivity(_other);
72 triangulate();
73 }
74
79
88 SmartFaceHandle add_face(const VertexHandle* _vhandles, size_t _vhs_size);
89
98 SmartFaceHandle add_face(const std::vector<VertexHandle>& _vhandles);
99
108 SmartFaceHandle add_face(const std::vector<SmartVertexHandle>& _vhandles);
109
120 SmartFaceHandle add_face(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2);
121
123
127 inline VertexHandle opposite_vh(HalfedgeHandle _heh) const
128 {
129 return is_boundary(_heh) ? InvalidVertexHandle :
130 to_vertex_handle(next_halfedge_handle(_heh));
131 }
132
136 VertexHandle opposite_he_opposite_vh(HalfedgeHandle _heh) const
137 { return opposite_vh(opposite_halfedge_handle(_heh)); }
138
142
143
148 bool is_collapse_ok(HalfedgeHandle _heh);
149
151 HalfedgeHandle vertex_split(VertexHandle v0, VertexHandle v1,
152 VertexHandle vl, VertexHandle vr);
153
155 bool is_flip_ok(EdgeHandle _eh) const;
156
159 void flip(EdgeHandle _eh);
160
161
173 void split(EdgeHandle _eh, VertexHandle _vh);
174
190 inline void split_edge(EdgeHandle _eh, VertexHandle _vh) { TriConnectivity::split(_eh, _vh); }
191
204 void split_copy(EdgeHandle _eh, VertexHandle _vh);
205
222 inline void split_edge_copy(EdgeHandle _eh, VertexHandle _vh) { TriConnectivity::split_copy(_eh, _vh); }
223
229 inline void split(FaceHandle _fh, VertexHandle _vh)
230 { PolyConnectivity::split(_fh, _vh); }
231
237 inline void split_copy(FaceHandle _fh, VertexHandle _vh)
238 { PolyConnectivity::split_copy(_fh, _vh); }
239
241
242 private:
244 HalfedgeHandle insert_loop(HalfedgeHandle _hh);
246 HalfedgeHandle insert_edge(VertexHandle _vh,
247 HalfedgeHandle _h0, HalfedgeHandle _h1);
248 };
249
250 }
251
252 #endif//OPENMESH_TRICONNECTIVITY_HH
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
OpenMesh::VertexHandle
Handle for a vertex entity.
Definition: Handles.hh:121
OpenMesh::HalfedgeHandle
Handle for a halfedge entity.
Definition: Handles.hh:128
OpenMesh::EdgeHandle
Handle for a edge entity.
Definition: Handles.hh:135
OpenMesh::FaceHandle
Handle for a face entity.
Definition: Handles.hh:142
OpenMesh::PolyConnectivity
Connectivity Class for polygonal meshes.
Definition: PolyConnectivity.hh:115
OpenMesh::PolyConnectivity::split_copy
void split_copy(FaceHandle _fh, VertexHandle _vh)
Face split (= 1-to-n split).
Definition: PolyConnectivity.cc:1064
OpenMesh::PolyConnectivity::assign_connectivity
void assign_connectivity(const PolyConnectivity &_other)
assign_connectivity() method.
Definition: PolyConnectivity.hh:478
OpenMesh::PolyConnectivity::split
void split(FaceHandle _fh, VertexHandle _vh)
Face split (= 1-to-n split).
Definition: PolyConnectivity.cc:1021
OpenMesh::TriConnectivity
Connectivity Class for Triangle Meshes.
Definition: TriConnectivity.hh:54
OpenMesh::TriConnectivity::split_edge
void split_edge(EdgeHandle _eh, VertexHandle _vh)
Edge split (= 2-to-4 split)
Definition: TriConnectivity.hh:190
OpenMesh::TriConnectivity::split_copy
void split_copy(FaceHandle _fh, VertexHandle _vh)
Face split (= 1-to-3) split, calls corresponding PolyMeshT function).
Definition: TriConnectivity.hh:237
OpenMesh::TriConnectivity::split_edge_copy
void split_edge_copy(EdgeHandle _eh, VertexHandle _vh)
Edge split (= 2-to-4 split)
Definition: TriConnectivity.hh:222
OpenMesh::TriConnectivity::opposite_he_opposite_vh
VertexHandle opposite_he_opposite_vh(HalfedgeHandle _heh) const
Returns the opposite vertex to the opposite halfedge of _heh in the face referenced by it returns Inv...
Definition: TriConnectivity.hh:136
OpenMesh::TriConnectivity::opposite_vh
VertexHandle opposite_vh(HalfedgeHandle _heh) const
Returns the opposite vertex to the halfedge _heh in the face referenced by _heh returns InvalidVertex...
Definition: TriConnectivity.hh:127
OpenMesh::TriConnectivity::split
void split(EdgeHandle _eh, VertexHandle _vh)
Edge split (= 2-to-4 split)
Definition: TriConnectivity.cc:395
OpenMesh::TriConnectivity::split
void split(FaceHandle _fh, VertexHandle _vh)
Face split (= 1-to-3) split, calls corresponding PolyMeshT function).
Definition: TriConnectivity.hh:229
OpenMesh::TriConnectivity::assign_connectivity
void assign_connectivity(const TriConnectivity &_other)
assign_connectivity() methods.
Definition: TriConnectivity.hh:66
OpenMesh::TriConnectivity::split_copy
void split_copy(EdgeHandle _eh, VertexHandle _vh)
Edge split (= 2-to-4 split)
Definition: TriConnectivity.cc:492