mirror of https://github.com/CGAL/cgal
fix headers, c++11 scoped enum and cgal return
This commit is contained in:
parent
60ebaf8348
commit
4bcb44f1d9
|
|
@ -29,13 +29,13 @@ typedef CGAL::Timer Timer;
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 5)
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Polyhedron mesh;
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input || !(input >> mesh) || mesh.empty()) {
|
||||
std::cerr << "Invalid off file." << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::cerr << "#triangles " << mesh.size_of_facets() << std::endl;
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
int init = std::atoi(argv[2]);
|
||||
if (init < 0 || init > 2)
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
const FT tol(std::atof(argv[3]));
|
||||
int iterations = std::atoi(argv[4]);
|
||||
std::cerr << "#init " << init << std::endl;
|
||||
|
|
@ -66,5 +66,5 @@ int main(int argc, char *argv[])
|
|||
std::cerr << "initialization time " << t.time() << " sec." << std::endl;
|
||||
std::cerr << "#proxies " << l21_vsa.get_proxies_size() << std::endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ typedef CGAL::Timer Timer;
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 5)
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Polyhedron mesh;
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input || !(input >> mesh) || mesh.empty()) {
|
||||
std::cerr << "Invalid off file." << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::cerr << "#triangles " << mesh.size_of_facets() << std::endl;
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
int init = std::atoi(argv[2]);
|
||||
if (init < 0 || init > 2)
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
const std::size_t num_proxies = std::atoi(argv[3]);
|
||||
const std::size_t num_iterations = std::atoi(argv[4]);
|
||||
std::cerr << "#init " << init << std::endl;
|
||||
|
|
@ -86,5 +86,5 @@ int main(int argc, char *argv[])
|
|||
|
||||
std::cerr << "total time " << t1.time() << " sec." << std::endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ int main()
|
|||
l21_approx.set_metric(metric, proxy_fitting);
|
||||
|
||||
// initialize 100 random proxies
|
||||
l21_approx.init_by_number(CGAL::VSA_seeding::Random, 100);
|
||||
l21_approx.init_by_number(CGAL::Random, 100);
|
||||
|
||||
// run 30 iterations to reduce the approximation error
|
||||
for (std::size_t i = 0; i < 30; ++i)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ int main()
|
|||
// free function interface with named parameters, separated with dots
|
||||
CGAL::vsa_mesh_approximation(input, output,
|
||||
CGAL::VSA::parameters::init_by_number(200). // seeding by target number of proxies
|
||||
init_method(CGAL::VSA_seeding::Hierarchical). // hierarchical init
|
||||
init_method(CGAL::Hierarchical). // hierarchical init
|
||||
iterations(30). // number of relaxation iterations after seeding
|
||||
anchor_point(std::back_inserter(anchors)). // get anchor vertices
|
||||
indexed_triangles(std::back_inserter(triangles))); // get indexed triangles
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ int main()
|
|||
compact_approx.set_metric(metric, proxy_fitting);
|
||||
|
||||
// approximation via 200 proxies and 30 iterations
|
||||
compact_approx.init_by_number(CGAL::VSA_seeding::Hierarchical, 200);
|
||||
compact_approx.init_by_number(CGAL::Hierarchical, 200);
|
||||
for (std::size_t i = 0; i < 30; ++i)
|
||||
compact_approx.run_one_step();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/linear_least_squares_fitting_3.h>
|
||||
|
||||
#include <CGAL/VSA_metrics.h>
|
||||
#include <CGAL/vsa_metrics.h>
|
||||
#include <CGAL/Default.h>
|
||||
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
#include <CGAL/license/Surface_mesh_approximation.h>
|
||||
|
||||
|
||||
#include <CGAL/VSA_metrics.h>
|
||||
#include <CGAL/VSA_approximation.h>
|
||||
#include <CGAL/vsa_metrics.h>
|
||||
#include <CGAL/vsa_approximation.h>
|
||||
#include <CGAL/internal/Surface_mesh_approximation/named_function_params.h>
|
||||
#include <CGAL/internal/Surface_mesh_approximation/named_params_helper.h>
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ bool vsa_mesh_approximation(const TriangleMesh &tm_in,
|
|||
vsa_l21.set_metric(l21_metric, l21_fitting);
|
||||
|
||||
// default random initialization
|
||||
CGAL::VSA_seeding init = choose_param(get_param(np, internal_np::init_method), CGAL::VSA_seeding::Random);
|
||||
CGAL::VSA_seeding init = choose_param(get_param(np, internal_np::init_method), CGAL::Random);
|
||||
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);
|
||||
if (num_proxies == 0 || num_proxies > num_faces(tm_in)) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int main()
|
|||
|
||||
// random init and run
|
||||
std::cout << "random init and run" << std::endl;
|
||||
l2_approx.init_by_number(CGAL::VSA_seeding::Random, 10);
|
||||
l2_approx.init_by_number(CGAL::Random, 10);
|
||||
for (std::size_t i = 0; i < 10; ++i)
|
||||
l2_approx.run_one_step();
|
||||
if (l2_approx.get_proxies_size() != 10)
|
||||
|
|
@ -124,7 +124,7 @@ int main()
|
|||
l2_approx.rebuild();
|
||||
if (l2_approx.get_proxies_size() != 0)
|
||||
return EXIT_FAILURE;
|
||||
l2_approx.init_by_error(CGAL::VSA_seeding::Hierarchical, drop, iterations);
|
||||
l2_approx.init_by_error(CGAL::Hierarchical, drop, iterations);
|
||||
for (std::size_t i = 0; i < 10; ++i)
|
||||
l2_approx.run_one_step();
|
||||
std::cout << "#proxies " << l2_approx.get_proxies_size() << std::endl;
|
||||
|
|
@ -133,7 +133,7 @@ int main()
|
|||
l2_approx.rebuild();
|
||||
if (l2_approx.get_proxies_size() != 0)
|
||||
return EXIT_FAILURE;
|
||||
l2_approx.init_by_error(CGAL::VSA_seeding::Incremental, drop, iterations);
|
||||
l2_approx.init_by_error(CGAL::Incremental, drop, iterations);
|
||||
for (std::size_t i = 0; i < 10; ++i)
|
||||
l2_approx.run_one_step();
|
||||
std::cout << "#proxies " << l2_approx.get_proxies_size() << std::endl;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ bool test_shape(const char *file_name, const std::size_t target_num_proxies)
|
|||
const FT drop(1e-8);
|
||||
const std::size_t num_iterations = 20;
|
||||
const std::size_t inner_iterations = 10;
|
||||
vsa_l21.init_by_error(CGAL::VSA_seeding::Incremental, drop, inner_iterations);
|
||||
vsa_l21.init_by_error(CGAL::Incremental, drop, inner_iterations);
|
||||
for (std::size_t i = 0; i < num_iterations; ++i)
|
||||
vsa_l21.run_one_step();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int main()
|
|||
L21ProxyFitting l21_fitting(mesh);
|
||||
vsa_l21.set_metric(l21_metric, l21_fitting);
|
||||
|
||||
vsa_l21.init_by_number(CGAL::VSA_seeding::Random, 100);
|
||||
vsa_l21.init_by_number(CGAL::Random, 100);
|
||||
std::vector<FT> error;
|
||||
for (std::size_t i = 0; i < 30; ++i)
|
||||
error.push_back(vsa_l21.run_one_step());
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ bool test_manifold(const char *file_name, const FT drop = FT(1e-8))
|
|||
// approximation, init from error, drop to the target error incrementally
|
||||
const std::size_t num_iterations = 20;
|
||||
const std::size_t inner_iterations = 5;
|
||||
vsa_l21.init_by_error(CGAL::VSA_seeding::Incremental, drop, inner_iterations);
|
||||
vsa_l21.init_by_error(CGAL::Incremental, drop, inner_iterations);
|
||||
for (std::size_t i = 0; i < num_iterations; ++i)
|
||||
vsa_l21.run_one_step();
|
||||
std::cout << "#proxies " << vsa_l21.get_proxies_size() << std::endl;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ int main()
|
|||
compact_approx.set_metric(metric, proxy_fitting);
|
||||
|
||||
std::cout << "random init and run" << std::endl;
|
||||
compact_approx.init_by_number(CGAL::VSA_seeding::Random, 20);
|
||||
compact_approx.init_by_number(CGAL::Random, 20);
|
||||
for (std::size_t i = 0; i < 20; ++i)
|
||||
compact_approx.run_one_step();
|
||||
if (compact_approx.get_proxies_size() != 20)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ int main()
|
|||
l21_vsa.set_metric(l21_metric, l21_fitting);
|
||||
|
||||
std::cout << "Seeding by number." << std::endl;
|
||||
l21_vsa.init_by_number(CGAL::VSA_seeding::Random, 50);
|
||||
l21_vsa.init_by_number(CGAL::Random, 50);
|
||||
if (l21_vsa.get_proxies_size() != 50)
|
||||
return EXIT_FAILURE;
|
||||
for (std::size_t i = 0; i < 10; ++i) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue