Developer Documentation
Loading...
Searching...
No Matches
unittests_polymesh_collapse.cc
1#include <gtest/gtest.h>
2#include <Unittests/unittests_common.hh>
3
4#include <iostream>
5
6namespace {
7
8class OpenMeshCollapsePoly : public OpenMeshBasePoly {
9
10 protected:
11
12 // This function is called before each test is run
13 virtual void SetUp() {
14 }
15
16 // This function is called after all tests are through
17 virtual void TearDown() {
18
19 // Do some final stuff with the member data here...
20 }
21
22 // Member already defined in OpenMeshBase
23 //Mesh mesh_;
24};
25
26/*
27 * ====================================================================
28 * Define tests below
29 * ====================================================================
30 */
31
32
33
34
35/*
36 * This code tests is_collapse_ok on a double sided triangle. The
37 * test mesh comprises three vertices, that are connected to form two
38 * triangles of opposite orientation. All halfedges should be non collapsable.
39 */
40TEST_F(OpenMeshCollapsePoly, CheckCollapseOkDoublesidedTriangle) {
41
42 mesh_.clear();
43
44 Mesh::VertexHandle vh0 = mesh_.add_vertex(Mesh::Point(0,0,0));
45 Mesh::VertexHandle vh1 = mesh_.add_vertex(Mesh::Point(1,0,0));
46 Mesh::VertexHandle vh2 = mesh_.add_vertex(Mesh::Point(1,1,0));
47 mesh_.add_face(vh0, vh1, vh2);
48 mesh_.add_face(vh0, vh2, vh1);
49
50
51
52 mesh_.request_vertex_status();
53 mesh_.request_face_status();
54 mesh_.request_edge_status();
55
56 int collapsable = 0;
57
58 for ( const auto hh : mesh_.all_halfedges() )
59 {
60 if (mesh_.is_collapse_ok(hh) )
61 collapsable++;
62 }
63
64
65 EXPECT_EQ(collapsable,0) << "No collapse should be ok when we have only a double sided Triangle";
66}
67
68
69
70}
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition PolyMeshT.hh:136
SmartVertexHandle add_vertex(const Point _p)
Definition PolyMeshT.hh:255
Kernel::Point Point
Coordinate type.
Definition PolyMeshT.hh:112