Skip to content

Commit

Permalink
SMS: Fix placement
Browse files Browse the repository at this point in the history
  • Loading branch information
afabri committed May 29, 2024
1 parent e90842f commit 8e5c5b8
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project(Surface_mesh_simplification_Tests)

find_package(CGAL REQUIRED)

create_single_source_cgal_program("issue_8213.cpp")
create_single_source_cgal_program("edge_collapse_topology.cpp")
create_single_source_cgal_program("test_edge_collapse_bounded_distance.cpp")
create_single_source_cgal_program("test_edge_collapse_Envelope.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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



Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#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/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>

#include <cstdlib>
#include <iostream>
#include <fstream>

namespace SMS = CGAL::Surface_mesh_simplification;

typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Surface_mesh<Kernel::Point_3> Surface_mesh;

int main() {

std::string filename("data/issue_8213.off");

Surface_mesh surface_mesh;

std::ifstream in(filename);
in >> surface_mesh;

const size_t target_number_of_faces = 3;
SMS::Face_count_stop_predicate<Surface_mesh> stop(target_number_of_faces);

std::cout << "Input mesh number of faces: " << surface_mesh.number_of_faces() << ", target number of faces: " << target_number_of_faces << std::endl;

SMS::edge_collapse(
surface_mesh,
stop,
CGAL::parameters::
filter(SMS::Bounded_normal_change_filter<>())
.get_cost(SMS::LindstromTurk_cost<Surface_mesh>())
.get_placement(SMS::LindstromTurk_placement<Surface_mesh>())
);

std::cout.precision(17);
std::cout << surface_mesh << std::endl;
return EXIT_SUCCESS;
}

0 comments on commit 8e5c5b8

Please sign in to comment.