2 #include <gtest/gtest.h> 3 #include <Unittests/unittests_common.hh> 13 virtual void SetUp() {
19 virtual void TearDown() {
33 virtual void SetUp() {
39 virtual void TearDown() {
56 #if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__) 60 TEST_F(OpenMesh_Triangle, cpp11_initializer_test) {
66 EXPECT_EQ( dot(vec1,vec2) ,0.0 );
79 TEST_F(OpenMesh_Triangle, cpp11_vertexrange_test) {
84 FAIL() <<
"The Vertexrange for an empty Mesh is not empty";
85 EXPECT_TRUE(t.is_valid());
96 int iteration_counter = 0;
99 EXPECT_TRUE(t.is_valid());
102 EXPECT_EQ(iteration_counter,5);
108 TEST_F(OpenMesh_Poly, cpp11_vertexrange_test) {
111 for(PolyMesh::VertexHandle t : mesh_.vertices())
113 FAIL() <<
"The Vertexrange for an empty Mesh is not empty";
114 EXPECT_TRUE(t.is_valid());
125 int iteration_counter = 0;
126 for(PolyMesh::VertexHandle t : mesh_.vertices())
128 EXPECT_TRUE(t.is_valid());
131 EXPECT_EQ(iteration_counter,5);
137 TEST_F(OpenMesh_Triangle, cpp11_vvrange_test) {
144 FAIL() <<
"The vvrange for a single vertex in a TriMesh is not empty";
145 EXPECT_TRUE(t.is_valid());
155 std::vector<Mesh::VertexHandle> face_vhandles;
157 face_vhandles.push_back(vhandle[0]);
158 face_vhandles.push_back(vhandle[1]);
159 face_vhandles.push_back(vhandle[2]);
160 mesh_.add_face(face_vhandles);
162 face_vhandles.clear();
164 face_vhandles.push_back(vhandle[1]);
165 face_vhandles.push_back(vhandle[3]);
166 face_vhandles.push_back(vhandle[4]);
167 mesh_.add_face(face_vhandles);
169 face_vhandles.clear();
171 face_vhandles.push_back(vhandle[0]);
172 face_vhandles.push_back(vhandle[3]);
173 face_vhandles.push_back(vhandle[1]);
174 mesh_.add_face(face_vhandles);
176 face_vhandles.clear();
178 face_vhandles.push_back(vhandle[2]);
179 face_vhandles.push_back(vhandle[1]);
180 face_vhandles.push_back(vhandle[4]);
181 mesh_.add_face(face_vhandles);
184 int iteration_counter = 0;
187 EXPECT_TRUE(t.is_valid());
190 EXPECT_EQ(iteration_counter,4);
196 TEST_F(OpenMesh_Poly, cpp11_vvrange_test) {
201 for(PolyMesh::VertexHandle t : mesh_.vv_range(vhandle[0]))
203 FAIL() <<
"The vvrange for a single vertex in a PolyMesh is not empty";
204 EXPECT_TRUE(t.is_valid());
214 std::vector<PolyMesh::VertexHandle> face_vhandles;
216 face_vhandles.push_back(vhandle[0]);
217 face_vhandles.push_back(vhandle[1]);
218 face_vhandles.push_back(vhandle[2]);
219 mesh_.add_face(face_vhandles);
221 face_vhandles.clear();
223 face_vhandles.push_back(vhandle[1]);
224 face_vhandles.push_back(vhandle[3]);
225 face_vhandles.push_back(vhandle[4]);
226 mesh_.add_face(face_vhandles);
228 face_vhandles.clear();
230 face_vhandles.push_back(vhandle[0]);
231 face_vhandles.push_back(vhandle[3]);
232 face_vhandles.push_back(vhandle[1]);
233 mesh_.add_face(face_vhandles);
235 face_vhandles.clear();
237 face_vhandles.push_back(vhandle[2]);
238 face_vhandles.push_back(vhandle[1]);
239 face_vhandles.push_back(vhandle[4]);
240 mesh_.add_face(face_vhandles);
243 int iteration_counter = 0;
244 for(PolyMesh::VertexHandle t : mesh_.vv_range(vhandle[1]))
246 EXPECT_TRUE(t.is_valid());
249 EXPECT_EQ(iteration_counter,4);
256 TEST_F(OpenMesh_Triangle, cpp11_test_enumerate_combined_run) {
263 FAIL() <<
"The vvrange for a single vertex in a TriMesh is not empty";
264 EXPECT_TRUE(t.is_valid());
274 std::vector<Mesh::VertexHandle> face_vhandles;
276 face_vhandles.push_back(vhandle[0]);
277 face_vhandles.push_back(vhandle[1]);
278 face_vhandles.push_back(vhandle[2]);
279 mesh_.add_face(face_vhandles);
281 face_vhandles.clear();
283 face_vhandles.push_back(vhandle[1]);
284 face_vhandles.push_back(vhandle[3]);
285 face_vhandles.push_back(vhandle[4]);
286 mesh_.add_face(face_vhandles);
288 face_vhandles.clear();
290 face_vhandles.push_back(vhandle[0]);
291 face_vhandles.push_back(vhandle[3]);
292 face_vhandles.push_back(vhandle[1]);
293 mesh_.add_face(face_vhandles);
295 face_vhandles.clear();
297 face_vhandles.push_back(vhandle[2]);
298 face_vhandles.push_back(vhandle[1]);
299 face_vhandles.push_back(vhandle[4]);
300 mesh_.add_face(face_vhandles);
303 for (
auto vh : mesh_.vertices() ) {
305 for (
auto vv_it : mesh_.vv_range(vh) ) {
306 p += mesh_.point(vv_it);
Kernel::Point Point
Coordinate type.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.