diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt index 152aeb11140..0131581545d 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt @@ -26,7 +26,7 @@ See below a sample call of a function that uses the optional BGL named parameter // anchors: output anchor points // triangles: output triplets of indexed triangles -CGAL::Surface_mesh_approximation::approximate_mesh(tm, +CGAL::Surface_mesh_approximation::approximate_triangle_mesh(tm, CGAL::parameters::seeding_method(method). max_number_of_proxies(number_of_proxies). number_of_iterations(number_of_iterations). diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt index 9303e39b77a..19f35f1a68c 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt @@ -35,7 +35,7 @@ and provides the list of parameters used in this package. - `ErrorMetricProxy` ## Main Functions ## -- `CGAL::Surface_mesh_approximation::approximate_mesh()` +- `CGAL::Surface_mesh_approximation::approximate_triangle_mesh()` ## Classes ## - `CGAL::Surface_mesh_approximation::L21_metric_plane_proxy` diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Surface_mesh_approximation.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Surface_mesh_approximation.txt index 00402966cf2..1435951bcc1 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Surface_mesh_approximation.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Surface_mesh_approximation.txt @@ -22,7 +22,7 @@ The approximation error is one-sided, defined between the clusters and their ass Variational shape approximation on two models with the \f$ \mathcal{L}^{2,1} \f$ error metric and planar proxies. From left to right: partition of the input surface triangle mesh, anchor vertices and edges, and output triangle mesh. The partition is optimized via discrete clustering of the input triangles, so as to minimize the approximation error from the clusters to the planar proxies (not shown). \cgalFigureEnd -This package offers both the approximation and mesh construction functionalities, through the free function `CGAL::Surface_mesh_approximation::approximate_mesh()` which runs a fully automated version of the algorithm: +This package offers both the approximation and mesh construction functionalities, through the free function `CGAL::Surface_mesh_approximation::approximate_triangle_mesh()` which runs a fully automated version of the algorithm: \cgalExample{Surface_mesh_approximation/vsa_simple_approximation_example.cpp} A class interface is also provided for advanced users, in which a series of pliant operators offer interactive capabilities during clustering and customization in terms of error and proxies. @@ -166,7 +166,7 @@ As there is no guarantee that the output mesh is 2-manifold and oriented, the ma This package can be used with any class model of the concept `FaceListGraph` described in \ref PkgBGL "CGAL and the Boost Graph Library". Free function with \ref vsa_namedparameters options. -- `CGAL::Surface_mesh_approximation::approximate_mesh()`: given a triangle mesh, approximate the geometry with default \f$ \mathcal{L}^{2,1} \f$ metric. +- `CGAL::Surface_mesh_approximation::approximate_triangle_mesh()`: given a triangle mesh, approximate the geometry with default \f$ \mathcal{L}^{2,1} \f$ metric. Class interface: - `CGAL::Variational_shape_approximation`: allowing more customization of the proxy, metric and approximation process. As shown in Figure \cgalFigureRef{workflow}, typical calling order of the approximation and meshing process is: @@ -181,7 +181,7 @@ One thing to note is that some parameters depend heavily on the input, like the \subsection sma_example1 Free Function Approximation -The following example calls the free function `CGAL::Surface_mesh_approximation::approximate_mesh()` on the input triangle mesh with default `CGAL::Surface_mesh_approximation::L21_metric_plane_proxy`. +The following example calls the free function `CGAL::Surface_mesh_approximation::approximate_triangle_mesh()` on the input triangle mesh with default `CGAL::Surface_mesh_approximation::L21_metric_plane_proxy`. \cgalExample{Surface_mesh_approximation/vsa_approximation_example.cpp} @@ -215,7 +215,7 @@ The following example defines a point-wise proxy to yield an isotropic approxima \section sma_perf Performances -We provide some performance comparisons with the free function API `CGAL::Surface_mesh_approximation::approximate_mesh`. +We provide some performance comparisons with the free function API `CGAL::Surface_mesh_approximation::approximate_triangle_mesh`. Timings are recorded on a PC running Windows10 X64 with an Intel Xeon E5-1620 clocked at 3.70 GHz with 32GB of RAM. The program has been optimized with the O2 option with Visual Studio 2015. By default the kernel used is `Exact_predicates_inexact_constructions_kernel` (`EPICK`). diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_2_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_2_example.cpp index b4ee5d3207f..24dd5abf74c 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_2_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_2_example.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; @@ -11,6 +11,8 @@ typedef boost::graph_traits::face_descriptor face_descriptor; typedef std::map Face_index_map; typedef boost::associative_property_map Face_proxy_pmap; +namespace VSA = CGAL::Surface_mesh_approximation; + int main() { // read input surface triangle mesh @@ -32,7 +34,7 @@ int main() std::vector proxies; // free function interface with named parameters - CGAL::Surface_mesh_approximation::approximate_mesh(input, + VSA::approximate_triangle_mesh(input, CGAL::parameters::min_error_drop(0.05). // seeding with minimum error drop number_of_iterations(40). // set number of clustering iterations after seeding subdivision_ratio(0.3). // set chord subdivision ratio threshold when meshing diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_example.cpp index 6533c99151f..01eb8e86eea 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_approximation_example.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -12,6 +12,8 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; +namespace VSA = CGAL::Surface_mesh_approximation; + int main() { // read input surface triangle mesh @@ -24,8 +26,8 @@ int main() std::vector > triangles; // triplets of indices // free function interface with named parameters - bool is_manifold = CGAL::Surface_mesh_approximation::approximate_mesh(input, - CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::HIERARCHICAL). // hierarchical seeding + bool is_manifold = VSA::approximate_triangle_mesh(input, + CGAL::parameters::seeding_method(VSA::HIERARCHICAL). // hierarchical seeding max_number_of_proxies(200). // seeding with maximum number of proxies number_of_iterations(30). // number of clustering iterations after seeding anchors(std::back_inserter(anchors)). // anchor vertices diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp index fe35e7ca19a..86b112d0cd4 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp @@ -5,6 +5,8 @@ #include #include +namespace VSA = CGAL::Surface_mesh_approximation; + typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; @@ -34,7 +36,7 @@ int main() error_metric); // seeds 100 random proxies - approx.initialize_seeds(CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::RANDOM) + approx.initialize_seeds(CGAL::parameters::seeding_method(VSA::RANDOM) .max_number_of_proxies(100)); // runs 30 iterations diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp index c6abd2999e7..4a1f025e324 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp @@ -21,6 +21,8 @@ typedef boost::property_map::type Vertex_poin typedef boost::associative_property_map > Face_area_map; typedef boost::associative_property_map > Face_center_map; +namespace VSA = CGAL::Surface_mesh_approximation; + // user-defined "compact" error metric using type Point_3 as proxy struct Compact_metric_point_proxy { @@ -100,7 +102,7 @@ int main() error_metric); // approximates via 200 proxies and 30 iterations - approx.initialize_seeds(CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::HIERARCHICAL) + approx.initialize_seeds(CGAL::parameters::seeding_method(VSA::HIERARCHICAL) .max_number_of_proxies(200)); approx.run(30); diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_segmentation_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_segmentation_example.cpp index e7139eae9be..bc69be1019e 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_segmentation_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_segmentation_example.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; @@ -11,6 +11,8 @@ typedef boost::graph_traits::face_descriptor Face_descriptor; typedef boost::unordered_map Face_index_map; typedef boost::associative_property_map Face_proxy_pmap; +namespace VSA = CGAL::Surface_mesh_approximation; + int main() { // reads input mesh @@ -26,7 +28,7 @@ int main() Face_proxy_pmap fpxmap(fidx_map); // free function interface with named parameters - CGAL::Surface_mesh_approximation::approximate_mesh(input, + VSA::approximate_triangle_mesh(input, CGAL::parameters::max_number_of_proxies(200). // first stop criterion min_error_drop(0.05). // second stop criterion number_of_iterations(30). // number of relaxation iterations after seeding diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_simple_approximation_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_simple_approximation_example.cpp index 5dd38e4ed01..59b251fc4d0 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_simple_approximation_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_simple_approximation_example.cpp @@ -3,11 +3,13 @@ #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; +namespace VSA = CGAL::Surface_mesh_approximation; + int main() { // read input surface triangle mesh @@ -20,8 +22,8 @@ int main() std::vector > triangles; // free function interface with named parameters - CGAL::Surface_mesh_approximation::approximate_mesh(input, - CGAL::parameters::verbose_level(CGAL::Surface_mesh_approximation::MAIN_STEPS). + VSA::approximate_triangle_mesh(input, + CGAL::parameters::verbose_level(VSA::MAIN_STEPS). max_number_of_proxies(200). anchors(std::back_inserter(anchors)). // anchor points triangles(std::back_inserter(triangles))); // indexed triangles diff --git a/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/approximate_mesh.h b/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h similarity index 99% rename from Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/approximate_mesh.h rename to Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h index 047a50595c5..5d30d5d4535 100644 --- a/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/approximate_mesh.h +++ b/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h @@ -125,7 +125,7 @@ unspecified_type all_default(); * \cgalNamedParamsEnd */ template -bool approximate_mesh(const TriangleMesh &tm, const NamedParameters &np) +bool approximate_triangle_mesh(const TriangleMesh &tm, const NamedParameters &np) { using boost::get_param; using boost::choose_param; diff --git a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h index f748aed74b2..d442b2dcce0 100644 --- a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h @@ -84,7 +84,7 @@ enum Seeding_method { /// \ingroup PkgTSMA /// @brief Main class for Variational Shape Approximation algorithm. -/// It is based on \cgalCite{cgal:cad-vsa-04}. For simple use cases, the function `CGAL::Surface_mesh_approximation::approximate_mesh()` might be sufficient. +/// It is based on \cgalCite{cgal:cad-vsa-04}. For simple use cases, the function `CGAL::Surface_mesh_approximation::approximate_triangle_mesh()` might be sufficient. /// @tparam TriangleMesh a model of `FaceListGraph` /// @tparam VertexPointMap a `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type /// @tparam ErrorMetricProxy a model of `ErrorMetricProxy` diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_approximation_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_approximation_test.cpp index ccd67a86b00..8a01d8b254e 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_approximation_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_approximation_test.cpp @@ -5,13 +5,13 @@ #include #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; /** - * This file tests the free function CGAL::Surface_mesh_approximation::approximate_mesh. + * This file tests the free function CGAL::Surface_mesh_approximation::approximate_triangle_mesh. */ int main() { @@ -29,7 +29,7 @@ int main() std::vector points; std::vector > triangles; - CGAL::Surface_mesh_approximation::approximate_mesh(mesh, + CGAL::Surface_mesh_approximation::approximate_triangle_mesh(mesh, CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::INCREMENTAL). max_number_of_proxies(6). number_of_iterations(30). diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp index 22ee9c23f8d..f0adc0a3b07 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp @@ -10,7 +10,7 @@ #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic; typedef CGAL::Simple_cartesian Sckernel; @@ -29,7 +29,7 @@ int test() { std::vector points; std::vector > triangles; - CGAL::Surface_mesh_approximation::approximate_mesh(tm, + CGAL::Surface_mesh_approximation::approximate_triangle_mesh(tm, CGAL::parameters::max_number_of_proxies(6). number_of_iterations(30). number_of_relaxations(5). diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_segmentation_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_segmentation_test.cpp index 299060482b6..e3970a2766a 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_segmentation_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_segmentation_test.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3 Polyhedron; @@ -12,7 +12,7 @@ typedef boost::unordered_map Face_index_map; typedef boost::associative_property_map Face_proxy_pmap; /** - * This file tests the free function CGAL::Surface_mesh_approximation::approximate_mesh. + * This file tests the free function CGAL::Surface_mesh_approximation::approximate_triangle_mesh. */ int main() { @@ -31,7 +31,7 @@ int main() std::vector proxies; // free function interface with named parameters - CGAL::Surface_mesh_approximation::approximate_mesh(input, + CGAL::Surface_mesh_approximation::approximate_triangle_mesh(input, CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::HIERARCHICAL). // hierarchical seeding max_number_of_proxies(200). // both maximum number of proxies stop criterion, min_error_drop(0.05). // and minimum error drop stop criterion are specified