OpenMesh
unittests_trimesh_circulator_edge.hh
1#include <Unittests/unittests_common.hh>
2
3#include <vector>
4
5namespace {
6
7class OpenMeshTrimeshCirculatorEdge : public OpenMeshBase {
8public:
9 using VH = OpenMesh::VertexHandle;
10 using FH = OpenMesh::FaceHandle;
11 using EH = OpenMesh::EdgeHandle;
12 using HEH = OpenMesh::HalfedgeHandle;
13
14 // This function is called before each test is run.
15 void SetUp() override {
16 std::vector<VH> vh;
17
18 // 3----2 5
19 // | /| |
20 // | / | |
21 // | / | |
22 // |/ | |
23 // 0----1 4
24
25 // A quad consisting of two triangles.
26 vh.push_back(mesh_.add_vertex({0.0, 0.0, 0.0})); // vh[0]
27 vh.push_back(mesh_.add_vertex({1.0, 0.0, 0.0})); // vh[1]
28 vh.push_back(mesh_.add_vertex({1.0, 1.0, 0.0})); // vh[2]
29 vh.push_back(mesh_.add_vertex({0.0, 1.0, 0.0})); // vh[3]
30 mesh_.add_face(vh[0], vh[1], vh[2]);
31 mesh_.add_face(vh[0], vh[2], vh[3]);
32
33 // An isolated edge.
34 vh.push_back(mesh_.add_vertex({2.0, 0.0, 0.0})); // vh[4]
35 vh.push_back(mesh_.add_vertex({2.0, 1.0, 0.0})); // vh[5]
36 auto heh = mesh_.new_edge(vh[4], vh[5]);
37 auto heh_opp = mesh_.opposite_halfedge_handle(heh);
38 mesh_.set_halfedge_handle(vh[4], heh);
39 mesh_.set_halfedge_handle(vh[5], heh_opp);
40
41 InteriorEdge = Edge(0, 2);
42 BoundaryEdge = Edge(0, 1);
43 IsolatedEdge = Edge(4, 5);
44 }
45
46 // Helper function to quickly retrieve edges from their endpoint vertex IDs.
47 EH Edge(int _vh0_idx, int _vh1_idx) {
48 VH vh0(_vh0_idx);
49 VH vh1(_vh1_idx);
50 HEH heh = mesh_.find_halfedge(vh0, vh1);
51 if (!heh.is_valid())
52 return EH();
53 return mesh_.edge_handle(heh);
54 }
55
56 // Handles of some interesting edges.
57 EH InteriorEdge;
58 EH BoundaryEdge;
59 EH IsolatedEdge;
60};
61
62}
Handle for a vertex entity.
Definition: Handles.hh:121
Handle for a halfedge entity.
Definition: Handles.hh:128
Handle for a edge entity.
Definition: Handles.hh:135
Handle for a face entity.
Definition: Handles.hh:142
Definition: unittests_common.hh:30

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .