Search code examples
c++cgal

CGAL : hausdorff distance bad alloc


I am trying to use approximate_Hausdorff_distance on CGAL::Surface_mesh_3 data structure meshes, but after +- 30 seconds of calculations i'm getting every time bad alloc . both meshes contains no more than 2k points

Code was taken from PMP example:

std::cout << "Approximated Hausdorff distance: "
          << CGAL::Polygon_mesh_processing::approximate_Hausdorff_distance
                <TAG>(mesh1, mesh2,
                CGAL::Polygon_mesh_processing::parameters::number_of_points_per_area_unit(4000))
          << std::endl;

Solution

  • As I replied you on the cgal-discuss mailing list, the problem is probably the paramater PMP::parameters::number_of_points_per_area_unit(4000), as if your mesh has a huge area there will be many points generated. If that is not the case please post a bug report so that we can reproduce and fix.