diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/hausdorff_bounded_error_distance_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/hausdorff_bounded_error_distance_example.cpp index dd32a2b5e4e..eb68fec8e2b 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/hausdorff_bounded_error_distance_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/hausdorff_bounded_error_distance_example.cpp @@ -10,21 +10,45 @@ #endif typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef K::Point_3 Point; -typedef CGAL::Surface_mesh Mesh; +typedef K::Point_3 Point_3; +typedef K::Triangle_3 Triangle_3; +typedef CGAL::Surface_mesh Mesh; +typedef Mesh::Vertex_index Vertex_index; namespace PMP = CGAL::Polygon_mesh_processing; int main() { Mesh tm1, tm2; - CGAL::make_tetrahedron(Point(.0,.0,.0), - Point(2,.0,.0), - Point(1,1,1), - Point(1,.0,2), +/* + CGAL::make_tetrahedron(Point_3(.0,.0,.0), + Point_3(2,.0,.0), + Point_3(1,1,1), + Point_3(1,.0,2), tm1); tm2=tm1; CGAL::Polygon_mesh_processing::isotropic_remeshing(tm2.faces(),.05, tm2); +*/ + tm1 = Mesh(); + tm1.add_vertex( Point_3(-1.,1.,1.) ); + tm1.add_vertex( Point_3(0.,-1.,1.) ); + tm1.add_vertex( Point_3(1.,1.,1.) ); + tm1.add_face( tm1.vertices() ); + + std::cout << "TM1 is valid: " << (tm1.is_valid() ? "true" : "false") << std::endl; + + tm2 = Mesh(); + Vertex_index w0 = tm2.add_vertex( Point_3(-1.,1.,0.) ); + Vertex_index w1 = tm2.add_vertex( Point_3(0.,-1.,0.) ); + Vertex_index w2 = tm2.add_vertex( Point_3(1.,1.,0.) ); + Vertex_index w3 = tm2.add_vertex( Point_3(0.,1.,-1.) ); + Vertex_index w4 = tm2.add_vertex( Point_3(-0.5,0.,-1.) ); + Vertex_index w5 = tm2.add_vertex( Point_3(0.5,0.,-1.) ); + tm2.add_face( w0, w3, w4 ); + tm2.add_face( w1, w4, w5 ); + tm2.add_face( w2, w5, w3 ); + + std::cout << "TM2 is valid: " << (tm2.is_valid() ? "true" : "false") << std::endl; std::cout << "Approximated Hausdorff distance: " << CGAL::Polygon_mesh_processing::bounded_error_Hausdorff_distance diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_Hausdorff_distance.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_Hausdorff_distance.h index 16e9e49f39d..2ffd206d9d1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_Hausdorff_distance.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_Hausdorff_distance.h @@ -67,8 +67,7 @@ namespace CGAL { // Compute the explicit Hausdorff distance to the given primitive void intersection(const Query& query, const Primitive& primitive) { - // Have reached a single triangle - std::cout << "Reached Triangle in TM2:" << primitive.id() << '\n'; + /* Have reached a single triangle, process it */ /* / Determine the distance accroding to @@ -222,8 +221,7 @@ namespace CGAL { // Compute the explicit Hausdorff distance to the given primitive void intersection(const Query& query, const Primitive& primitive) { - // Have reached a single triangle - std::cout << "Reached Triangle in TM1: " << primitive.id() << '\n'; + /* Have reached a single triangle, process it */ // Map to transform faces of TM1 to actual triangles Triangle_from_face_descriptor_map m_face_to_triangle_map( &m_tm1, m_vpm1 ); @@ -251,11 +249,14 @@ namespace CGAL { h_upper = local_bounds.second; } + std::cout << "Processed triangle: " << primitive.id() + << ", found bounds (low., up.): (" << local_bounds.first + << ", " << local_bounds.second << ")" << std::endl; + + // Store the triangle given as primitive here as candidate triangle + // together with the local bounds it obtained to sind it to subdivision + // later m_candidiate_triangles.push_back(Candidate_triangle(candidate_triangle, local_bounds)); - /* TODO Store the triangle given here is primitive as candidate triangle - together with the local bounds it optained to send it to - subdivision later. - */ } // Determine whether child nodes will still contribute to a larger