cleanup examples

This commit is contained in:
Pierre Alliez 2018-03-14 22:06:56 +01:00
parent b940dea08f
commit 07cb9e4c52
3 changed files with 20 additions and 18 deletions

View File

@ -16,7 +16,7 @@ typedef Mesh_approximation::Error_metric L21_metric;
int main()
{
// read input surface triangle mesh
// reads input surface triangle mesh
Polyhedron input;
std::ifstream file("data/mask.off");
if (!file || !(file >> input) || input.empty()) {
@ -24,34 +24,36 @@ int main()
return EXIT_FAILURE;
}
// create VSA algorithm instance
// creates VSA algorithm instance
Mesh_approximation approx(input,
get(boost::vertex_point, const_cast<Polyhedron &>(input)));
// set error and fitting functors
// sets error and fitting functors
L21_metric metric(input,
get(boost::vertex_point, const_cast<Polyhedron &>(input)));
approx.set_metric(metric);
// seeding 100 random proxies
// seeds 100 random proxies
approx.seeding(CGAL::Random, 100);
// run 30 iterations
// runs 30 iterations
approx.run(30);
// add 3 proxies to the one with the maximum fitting error
// run 5 iterations between each addition
// adds 3 proxies to the one with the maximum fitting error,
// running 5 iterations between each addition
approx.add_to_furthest_proxies(3, 5);
// run 10 iterations
// runs 10 iterations
approx.run(10);
// teleport 2 proxies to tunnel out of local minima
// run 5 iterations between each teleport
// teleports 2 proxies to tunnel out of local minima,
// running 5 iterations between each teleport
approx.teleport_proxies(2, 5);
// runs 10 iterations
approx.run(10);
// meshing with default parameters
// generates output mesh with default parameters
approx.extract_mesh();
return EXIT_SUCCESS;

View File

@ -62,7 +62,7 @@ typedef CGAL::VSA_approximation<
int main()
{
// create polyhedral surface and read input mesh
// creates polyhedral surface and reads input mesh
Polyhedron input;
std::ifstream file("data/bear.off");
if (!file || !(file >> input) || input.empty()) {
@ -70,7 +70,7 @@ int main()
return EXIT_FAILURE;
}
// construct precomputed facet normal and area map
// constructs precomputed facet normal and area map
std::map<Facet_handle, FT> facet_areas;
std::map<Facet_handle, Point> facet_centers;
for(Facet_iterator fitr = input.facets_begin(); fitr != input.facets_end(); ++fitr) {
@ -86,15 +86,15 @@ int main()
Facet_area_map area_pmap(facet_areas);
Facet_center_map center_pmap(facet_centers);
// create compact metric approximation algorithm instance
// creates compact metric approximation algorithm instance
Approximation approx(input,
get(boost::vertex_point, const_cast<Polyhedron &>(input)));
// construct and set metric
// constructs and set metric
Compact_metric metric(center_pmap, area_pmap);
approx.set_metric(metric);
// approximation via 200 proxies and 30 iterations
// approximates via 200 proxies and 30 iterations
approx.seeding(CGAL::Hierarchical, 200);
approx.run(30);

View File

@ -13,7 +13,7 @@ typedef boost::associative_property_map<Facet_index_map> Facet_proxy_pmap;
int main()
{
// create polyhedral surface and read input surface triangle mesh
// creates polyhedral surface and reads input mesh
Polyhedron input;
std::ifstream file("data/mask.off");
if (!file || !(file >> input) || input.empty()) {
@ -36,7 +36,7 @@ int main()
nb_of_iterations(30). // number of iterations after seeding
facet_proxy_map(fpxmap)); // output facet proxy-id map
// TODO: retrieve segments of the segmentation
// TODO: iterates over segments and outputs to console
return EXIT_SUCCESS;
}