1 #include <gtest/gtest.h> 2 #include <Unittests/unittests_common.hh> 13 virtual void SetUp() {
17 virtual void TearDown() {
35 TEST_F(OpenMeshOthers, IsEstimatedFeatureEdge) {
48 std::vector<Mesh::VertexHandle> face_vhandles;
50 face_vhandles.push_back(vhandle[0]);
51 face_vhandles.push_back(vhandle[1]);
52 face_vhandles.push_back(vhandle[2]);
53 mesh_.add_face(face_vhandles);
55 face_vhandles.clear();
57 face_vhandles.push_back(vhandle[0]);
58 face_vhandles.push_back(vhandle[2]);
59 face_vhandles.push_back(vhandle[3]);
60 mesh_.add_face(face_vhandles);
62 face_vhandles.clear();
64 face_vhandles.push_back(vhandle[2]);
65 face_vhandles.push_back(vhandle[1]);
66 face_vhandles.push_back(vhandle[3]);
67 mesh_.add_face(face_vhandles);
69 face_vhandles.clear();
71 face_vhandles.push_back(vhandle[3]);
72 face_vhandles.push_back(vhandle[1]);
73 face_vhandles.push_back(vhandle[0]);
74 mesh_.add_face(face_vhandles);
85 mesh_.request_vertex_normals();
86 mesh_.request_halfedge_normals();
87 mesh_.request_face_normals();
93 Mesh::HalfedgeIter he_it = mesh_.halfedges_begin();
118 TEST_F(OpenMeshOthers, CalcDihedralAngre ) {
139 std::vector<Mesh::VertexHandle> face_vhandles;
141 face_vhandles.push_back(vhandle[0]);
142 face_vhandles.push_back(vhandle[1]);
143 face_vhandles.push_back(vhandle[2]);
144 mesh_.add_face(face_vhandles);
146 face_vhandles.clear();
148 face_vhandles.push_back(vhandle[0]);
149 face_vhandles.push_back(vhandle[2]);
150 face_vhandles.push_back(vhandle[3]);
151 mesh_.add_face(face_vhandles);
157 Mesh::HalfedgeHandle he = mesh_.halfedge_handle(4);
159 EXPECT_EQ( 0 , mesh_.to_vertex_handle(he).idx() ) <<
"Wrong halfedge!" << std::endl;
160 EXPECT_EQ( 2 , mesh_.from_vertex_handle(he).idx() ) <<
"Wrong halfedge!" << std::endl;
161 EXPECT_EQ( 2 , mesh_.edge_handle(he).idx() ) <<
"Wrong Edge!" << std::endl;
163 Mesh::EdgeHandle eh = mesh_.edge_handle(he);
164 EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) <<
"Wrong Dihedral angle!" << std::endl;
168 mesh_.point(vhandle[2]) = tmp;
170 double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) );
172 EXPECT_LT(difference, 0.00001) <<
"Wrong Dihedral angle, Difference is to big!" << std::endl;
void update_normals()
Compute normals for all primitives.
bool is_estimated_feature_edge(HalfedgeHandle _heh, const double _feature_angle) const
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Kernel::Point Point
Coordinate type.