Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
unittests_trimesh_vec2i.cc
1 #include <gtest/gtest.h>
2 #include <Unittests/unittests_common.hh>
3
4 #include <iostream>
5
6 struct CustomTraitsVec2i : OpenMesh::DefaultTraits
7 {
8 typedef OpenMesh::Vec2i Point;
9 };
10
11
12 typedef OpenMesh::TriMesh_ArrayKernelT<CustomTraitsVec2i> TriMeshVec2i;
13
14
15 /*
16 * OpenMesh Triangular with Vec2i
17 */
18
19 class OpenMeshBaseTriVec2i : public testing::Test {
20
21 protected:
22
23 // This function is called before each test is run
24 virtual void SetUp() {
25
26 // Do some initial stuff with the member data here...
27 }
28
29 // This function is called after all tests are through
30 virtual void TearDown() {
31
32 // Do some final stuff with the member data here...
33 }
34
35 // This member will be accessible in all tests
36 TriMeshVec2i mesh_;
37 };
38
39
40 namespace {
41
42 /*
43 * ====================================================================
44 * Define tests below
45 * ====================================================================
46 */
47
48 /*
49 * Checking for feature edges based on angle
50 */
51 TEST_F(OpenMeshBaseTriVec2i, Instance_Vec2i_Mesh) {
52
53 mesh_.clear();
54
55 // Add some vertices
56 TriMeshVec2i::VertexHandle vhandle[4];
57
58 vhandle[0] = mesh_.add_vertex(TriMeshVec2i::Point(0, 0));
59 vhandle[1] = mesh_.add_vertex(TriMeshVec2i::Point(0, 1));
60 vhandle[2] = mesh_.add_vertex(TriMeshVec2i::Point(1, 1));
61
62 // Add face
63 std::vector<TriMeshVec2i::VertexHandle> face_vhandles;
64
65 face_vhandles.push_back(vhandle[0]);
66 face_vhandles.push_back(vhandle[1]);
67 face_vhandles.push_back(vhandle[2]);
68 mesh_.add_face(face_vhandles);
69
70 // ===============================================
71 // Setup complete
72 // ===============================================
73
74 // Check one Request only vertex normals
75 // Face normals are required for vertex and halfedge normals, so
76 // that prevent access to non existing properties are in place
77
78 mesh_.request_vertex_normals();
79 mesh_.request_halfedge_normals();
80 mesh_.request_face_normals();
81
82 }
83
84 }
OpenMeshBaseTriVec2i
Definition: unittests_trimesh_vec2i.cc:19
OpenMesh::PolyMeshT::Point
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:115
OpenMesh::PolyMeshT::add_vertex
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Definition: PolyMeshT.hh:236
OpenMesh::TriMesh_ArrayKernelT< CustomTraitsVec2i >
OpenMesh::VectorT< signed int, 2 >
OpenMesh::PolyMeshT::VertexHandle
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:139
OpenMesh::DefaultTraits
Definition: Traits.hh:126
CustomTraitsVec2i
Definition: unittests_polymesh_vec2i.cc:6