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