mirror of https://github.com/CGAL/cgal
approximate_mesh -> approximate_triangle_mesh
This commit is contained in:
parent
9b8f82ea60
commit
b91dc57fd2
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
|
|||
|
|
@ -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`).
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
|
|
@ -11,6 +11,8 @@ typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
|
|||
typedef std::map<face_descriptor, std::size_t> Face_index_map;
|
||||
typedef boost::associative_property_map<Face_index_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<Kernel::Vector_3> 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
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
|
||||
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
|
||||
namespace VSA = CGAL::Surface_mesh_approximation;
|
||||
|
||||
int main()
|
||||
{
|
||||
// read input surface triangle mesh
|
||||
|
|
@ -24,8 +26,8 @@ int main()
|
|||
std::vector<CGAL::cpp11::array<std::size_t, 3> > 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
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Variational_shape_approximation.h>
|
||||
|
||||
namespace VSA = CGAL::Surface_mesh_approximation;
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> 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
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ typedef boost::property_map<Polyhedron, boost::vertex_point_t>::type Vertex_poin
|
|||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > Face_area_map;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, Point> > 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);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
|
|
@ -11,6 +11,8 @@ typedef boost::graph_traits<Polyhedron>::face_descriptor Face_descriptor;
|
|||
typedef boost::unordered_map<Face_descriptor, std::size_t> Face_index_map;
|
||||
typedef boost::associative_property_map<Face_index_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
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
|
||||
namespace VSA = CGAL::Surface_mesh_approximation;
|
||||
|
||||
int main()
|
||||
{
|
||||
// read input surface triangle mesh
|
||||
|
|
@ -20,8 +22,8 @@ int main()
|
|||
std::vector<CGAL::cpp11::array<std::size_t, 3> > 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
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ unspecified_type all_default();
|
|||
* \cgalNamedParamsEnd
|
||||
*/
|
||||
template <typename TriangleMesh, typename NamedParameters>
|
||||
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;
|
||||
|
|
@ -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<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type
|
||||
/// @tparam ErrorMetricProxy a model of `ErrorMetricProxy`
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> 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<Kernel::Point_3> points;
|
||||
std::vector<CGAL::cpp11::array<std::size_t, 3> > 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).
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic;
|
||||
typedef CGAL::Simple_cartesian<double> Sckernel;
|
||||
|
|
@ -29,7 +29,7 @@ int test() {
|
|||
std::vector<typename K::Point_3> points;
|
||||
std::vector<CGAL::cpp11::array<std::size_t, 3> > 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).
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_mesh.h>
|
||||
#include <CGAL/Surface_mesh_approximation/approximate_triangle_mesh.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
|
|
@ -12,7 +12,7 @@ typedef boost::unordered_map<face_descriptor, std::size_t> Face_index_map;
|
|||
typedef boost::associative_property_map<Face_index_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<Kernel::Vector_3> 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue