This commit is contained in:
Mael 2025-07-17 11:37:58 +02:00 committed by GitHub
parent 4018082784
commit 13f5968eaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 25 deletions

View File

@ -18,7 +18,7 @@
namespace CGAL::Surface_mesh_simplification::internal{
// a*b - c*d
// a*b - c*d
// The next two functions are from https://stackoverflow.com/questions/63665010/accurate-floating-point-computation-of-the-sum-and-difference-of-two-products
inline double diff_of_products_kahan(const double a, const double b, const double c, const double d)
{

View File

@ -1,16 +1,13 @@
OFF
5 4 0
0.60153250345565623 3.2925554343503594 -0.93390733763467004
0.50125687092531912 3.266008536541555 -0.80580753798383942
0.57499779785916183 3.2558452065056969 -0.97860403852322797
0.56586410588624558 3.2541065339825863 -0.99341202997519495
0.56756366821062887 3.2478315549358072 -0.99100621040927039
3 0 1 2
3 1 3 2
3 1 0 3
3 0 4 3
0.60153250345565623 3.2925554343503594 -0.93390733763467004
0.50125687092531912 3.266008536541555 -0.80580753798383942
0.57499779785916183 3.2558452065056969 -0.97860403852322797
0.56586410588624558 3.2541065339825863 -0.99341202997519495
0.56756366821062887 3.2478315549358072 -0.99100621040927039
3 0 1 2
3 1 3 2
3 1 0 3
3 0 4 3

View File

@ -3,8 +3,6 @@
#include <CGAL/Surface_mesh.h>
CGAL::Bbox_3 bbox_g;
double max_bbox_g;
#define CGAL_CHECK_EXPENSIVE
#define CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE 5
@ -17,7 +15,6 @@ void Surface_simplification_external_trace(const std::string& s)
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_normal_change_filter.h>
// #include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounding_box_filter.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h>
@ -50,20 +47,15 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
auto bb=PMP::bbox(sm);
CGAL::Bbox_3 bb = PMP::bbox(sm);
std::cout << "Bbox:" << bb << std::endl;
std::cout << "Input mesh has " << num_vertices(sm) << " vertices" << std::endl;
std::cout << "Input mesh has " << num_faces(sm) << " faces" << std::endl;
SMS::Face_count_stop_predicate<Surface_mesh> stop(1);
SMS::edge_collapse(
sm,
stop,
CGAL::parameters::
// filter(SMS::Bounded_normal_change_filter<>()) //<SMS::Bounding_box_filter<>>(SMS::Bounding_box_filter<>()))
get_cost(SMS::LindstromTurk_cost<Surface_mesh>())
.get_placement(SMS::LindstromTurk_placement<Surface_mesh>())
SMS::edge_collapse(sm, stop,
CGAL::parameters::get_cost(SMS::LindstromTurk_cost<Surface_mesh>())
.get_placement(SMS::LindstromTurk_placement<Surface_mesh>())
);
CGAL::IO::write_OFF(std::cout, sm, CGAL::parameters::stream_precision(17));