Fixed warnings in Composite computation (extra;)
Fixed missing this pointer in PolyMeshT.hh Added unittest for dihedral angle function git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@757 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -472,11 +472,11 @@ public:
|
||||
|
||||
// calculates the dihedral angle on the edge _eh
|
||||
Scalar calc_dihedral_angle(EdgeHandle _eh) const
|
||||
{ return calc_dihedral_angle(halfedge_handle(_eh,0)); }
|
||||
{ return calc_dihedral_angle(this->halfedge_handle(_eh,0)); }
|
||||
|
||||
/** tags an edge as a feature if its dihedral angle is larger than _angle_tresh
|
||||
returns the number of the found feature edges, requires edge_status property*/
|
||||
uint find_feature_edges(Scalar _angle_tresh = OpenMesh::deg_to_rad(44.0));
|
||||
unsigned int find_feature_edges(Scalar _angle_tresh = OpenMesh::deg_to_rad(44.0));
|
||||
// --- misc ---
|
||||
|
||||
/// Face split (= 1-to-n split)
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
|
||||
void raise(typename M::FaceHandle& _fh, state_t _target_state);
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -153,8 +153,8 @@ public:
|
||||
VF(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::FaceHandle& _fh, state_t _target_state);
|
||||
MIPS_WARN_WA(Edge);
|
||||
MIPS_WARN_WA(Vertex);
|
||||
MIPS_WARN_WA(Edge)
|
||||
MIPS_WARN_WA(Vertex)
|
||||
};
|
||||
|
||||
|
||||
@@ -175,8 +175,8 @@ public:
|
||||
FF(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::FaceHandle& _fh, state_t _target_state);
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Edge ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
MIPS_WARN_WA(Edge ) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -197,8 +197,8 @@ public:
|
||||
FFc(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::FaceHandle& _fh, state_t _target_state);
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Edge ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
MIPS_WARN_WA(Edge ) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -219,8 +219,8 @@ public:
|
||||
FV(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face); // avoid warning
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Face) // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -241,8 +241,8 @@ public:
|
||||
FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
|
||||
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face); // avoid warning
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Face) // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
|
||||
static void init_coeffs(size_t _max_valence);
|
||||
static const std::vector<double>& coeffs() { return coeffs_; }
|
||||
@@ -278,8 +278,8 @@ public:
|
||||
VV(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face); // avoid warning
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Face) // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -300,8 +300,8 @@ public:
|
||||
VVc(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face); // avoid warning
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Face) // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -322,8 +322,8 @@ public:
|
||||
VE(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::EdgeHandle& _eh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Face ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -344,8 +344,8 @@ public:
|
||||
VdE(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::EdgeHandle& _eh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Face ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -366,8 +366,8 @@ public:
|
||||
VdEc(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::EdgeHandle& _eh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Face ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -388,8 +388,8 @@ public:
|
||||
EV(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face); // avoid warning
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Face) // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -411,8 +411,8 @@ public:
|
||||
EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
|
||||
|
||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face); // avoid warning
|
||||
MIPS_WARN_WA(Edge); // avoid warning
|
||||
MIPS_WARN_WA(Face) // avoid warning
|
||||
MIPS_WARN_WA(Edge) // avoid warning
|
||||
|
||||
static void init_coeffs(size_t _max_valence);
|
||||
static const std::vector<double>& coeffs() { return coeffs_; }
|
||||
@@ -447,8 +447,8 @@ public:
|
||||
EF(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::FaceHandle& _fh, state_t _target_state);
|
||||
MIPS_WARN_WA(Edge ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Edge ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -469,8 +469,8 @@ public:
|
||||
FE(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::EdgeHandle& _eh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Face ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -491,8 +491,8 @@ public:
|
||||
EdE(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::EdgeHandle& _eh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Face ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
|
||||
@@ -513,8 +513,8 @@ public:
|
||||
EdEc(M& _mesh) : Inherited(_mesh) {}
|
||||
|
||||
void raise(typename M::EdgeHandle& _eh, state_t _target_state);
|
||||
MIPS_WARN_WA(Face ); // avoid warning
|
||||
MIPS_WARN_WA(Vertex); // avoid warning
|
||||
MIPS_WARN_WA(Face ) // avoid warning
|
||||
MIPS_WARN_WA(Vertex) // avoid warning
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -113,4 +113,65 @@ TEST_F(OpenMeshOthers, IsEstimatedFeatureEdge) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Checking for feature edges based on angle
|
||||
*/
|
||||
TEST_F(OpenMeshOthers, CalcDihedralAngre ) {
|
||||
|
||||
mesh_.clear();
|
||||
|
||||
/* Test setup:
|
||||
*
|
||||
* 1 -- 2
|
||||
* | / |
|
||||
* | / |
|
||||
* 0 -- 3
|
||||
*/
|
||||
|
||||
// Add some vertices
|
||||
Mesh::VertexHandle vhandle[4];
|
||||
|
||||
vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 0, 0));
|
||||
vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
|
||||
vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0));
|
||||
vhandle[3] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
|
||||
|
||||
// Add four faces
|
||||
std::vector<Mesh::VertexHandle> face_vhandles;
|
||||
|
||||
face_vhandles.push_back(vhandle[0]);
|
||||
face_vhandles.push_back(vhandle[1]);
|
||||
face_vhandles.push_back(vhandle[2]);
|
||||
mesh_.add_face(face_vhandles);
|
||||
|
||||
face_vhandles.clear();
|
||||
|
||||
face_vhandles.push_back(vhandle[0]);
|
||||
face_vhandles.push_back(vhandle[2]);
|
||||
face_vhandles.push_back(vhandle[3]);
|
||||
mesh_.add_face(face_vhandles);
|
||||
|
||||
// ===============================================
|
||||
// Setup complete
|
||||
// ===============================================
|
||||
|
||||
Mesh::HalfedgeHandle he = mesh_.halfedge_handle(4);
|
||||
|
||||
EXPECT_EQ( 0 , mesh_.to_vertex_handle(he).idx() ) << "Wrong halfedge!" << std::endl;
|
||||
EXPECT_EQ( 2 , mesh_.from_vertex_handle(he).idx() ) << "Wrong halfedge!" << std::endl;
|
||||
EXPECT_EQ( 2 , mesh_.edge_handle(he).idx() ) << "Wrong Edge!" << std::endl;
|
||||
|
||||
Mesh::EdgeHandle eh = mesh_.edge_handle(he);
|
||||
EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl;
|
||||
|
||||
// Modify point
|
||||
Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * 0.5;
|
||||
mesh_.point(vhandle[2]) = tmp;
|
||||
|
||||
double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) );
|
||||
|
||||
EXPECT_TRUE( (difference < 0.00001 ) ) << "Wrong Dihedral angle, Difference is to big!" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
#endif // INCLUDE GUARD
|
||||
|
||||
Reference in New Issue
Block a user