free function API init with explicit method

This commit is contained in:
Lingjie Zhu 2017-11-10 20:44:23 +08:00
parent 7cbf80b02b
commit f7ddca3b07
3 changed files with 13 additions and 3 deletions

View File

@ -25,10 +25,10 @@ int main()
std::vector<std::size_t> triangles; std::vector<std::size_t> triangles;
std::vector<Kernel::Point_3> anchors; std::vector<Kernel::Point_3> anchors;
// free function interface with named parameters, seperated with dots // free function interface with named parameters, separated with dots
CGAL::vsa_mesh_approximation(input, output, CGAL::vsa_mesh_approximation(input, output,
CGAL::VSA::parameters::init_by_number(200). // seeding by target number of proxies CGAL::VSA::parameters::init_by_number(200). // seeding by target number of proxies
init_method(1). // hierarchical init init_method(CGAL::Method::Hierarchical). // hierarchical init
iterations(30). // number of relaxation iterations after seeding iterations(30). // number of relaxation iterations after seeding
anchor_point(std::back_inserter(anchors)). // get anchor points anchor_point(std::back_inserter(anchors)). // get anchor points
indexed_triangles(std::back_inserter(triangles))); // get indexed triangles indexed_triangles(std::back_inserter(triangles))); // get indexed triangles

View File

@ -32,6 +32,16 @@
namespace CGAL namespace CGAL
{ {
/// Seeding method enumeration
enum Method {
/// Random seeding
Random,
/// Incremental seeding
Incremental,
/// Hierarchical seeding
Hierarchical
};
/*! /*!
* \ingroup PkgTSMA * \ingroup PkgTSMA
* @brief Main class for Variational Shape Approximation algorithm. * @brief Main class for Variational Shape Approximation algorithm.

View File

@ -93,7 +93,7 @@ bool vsa_mesh_approximation(const TriangleMesh &tm_in,
vsa_l21.set_metric(l21_metric, l21_fitting); vsa_l21.set_metric(l21_metric, l21_fitting);
// default random initialization // default random initialization
int init = choose_param(get_param(np, internal_np::init_method), 0); CGAL::Method init = choose_param(get_param(np, internal_np::init_method), CGAL::Method::Random);
std::size_t num_proxies = choose_param(get_param(np, internal_np::init_by_number), 0); std::size_t num_proxies = choose_param(get_param(np, internal_np::init_by_number), 0);
std::size_t inner_iterations = choose_param(get_param(np, internal_np::inner_iterations), 10); std::size_t inner_iterations = choose_param(get_param(np, internal_np::inner_iterations), 10);
if (num_proxies == 0 || num_proxies > num_faces(tm_in)) { if (num_proxies == 0 || num_proxies > num_faces(tm_in)) {