diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/DistanceProxy.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/DistanceProxy.h deleted file mode 100644 index ad31fca56d2..00000000000 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/DistanceProxy.h +++ /dev/null @@ -1,45 +0,0 @@ - -/*! -\ingroup PkgTSMAConcepts -\cgalConcept - -The Euclidean distance proxy. - -\cgalRefines `Proxy` -\cgalHasModel `TBD` -*/ -class DistanceProxy { -public: - /*! 3D point type - * It must be default constructible, and can be constructed from 3 objects of type `FT`. - * `bool operator<(Point_3, Point_3)` to lexicographically compare two points must be available. - * Access to Cartesian coordinates must be possible using `Point_3::x()`, `Point_3::y(), Point_3::z()` and - * `FT operator[](int i)` with `0 <= i < 3`. - * - * There must be a specialization of `CGAL::Kernel_traits` such that - * `CGAL::Kernel_traits::%Kernel` is a model implementing this concept. - */ - typedef unspecified_type Point_3; - - /// 3D vector type - typedef unspecified_type Vector_3; - /// 3D plane type - typedef unspecified_type Plane_3; - - /// Triangle mesh facet descriptor. - typedef unspecified_type facet_descriptor; - - /// @name Data members - /// @{ - - /// data member to describe the plane proxy center position. - Point_3 center; - /// data member to describe the plane proxy normal. - Vector_3 normal; - /// data member to describe the proxy seed. - facet_descriptor seed; - /// data member to describe the fitted plane. - Plane_3 fit_plane; - - /// } -}; \ No newline at end of file diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ErrorMetric.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ErrorMetric.h index 06914fd0e22..80034295b98 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ErrorMetric.h +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ErrorMetric.h @@ -5,8 +5,8 @@ This is a functor to compute the fitting error of a facet to a proxy. -\cgalHasModel `L21ErrorMetric` -\cgalHasModel `DistanceErrorMetric` +\cgalHasModel `L21Metric` +\cgalHasModel `L2Metric` */ class ErrorMetric { diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/L21ErrorMetric.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/L21ErrorMetric.h deleted file mode 100644 index 1b3fbd36d1a..00000000000 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/L21ErrorMetric.h +++ /dev/null @@ -1,39 +0,0 @@ - -/*! -\ingroup PkgTSMAConcepts -\cgalConcept - -This is a functor to compute the L21 fitting error of a facet to a proxy. -Is this concept needed? - -\cgalRefines `ErrorMetric` -\cgalHasModel `L21Metric` - -*/ -class L21ErrorMetric { -public: - /*! - * A number type model of `Field` and `RealEmbeddable` - */ - typedef unspecified_type FT; - /// Triangle mesh facet descriptor. - typedef unspecified_type facet_descriptor; - /// Parametrized shape proxy. - typedef unspecified_type Proxy; - /// 3D vector type - typedef unspecified_type Vector_3; - - /// @name Functors - /// @{ - /// Functor for computing scaled vector. Is this required? - typedef unspecified_type Construct_scaled_vector_3; - - /// } - - /// @name Functions - /// @{ - /// data member to describe the proxy seed. - FT operator()(const facet_descriptor &f, const Proxy &px); - /// } -}; - diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/PlaneFitting.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/PlaneFitting.h new file mode 100644 index 00000000000..a5e702d6e54 --- /dev/null +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/PlaneFitting.h @@ -0,0 +1,17 @@ +/*! +\ingroup PkgTSMAConcepts +\cgalConcept + +The function object class to fit a plane from a range of facets. + +\cgalHasModel `PlaneFitting` +\cgalHasModel `PCAPlaneFitting` + +*/ +class PlaneFitting { + typedef unspecified_type Proxy; + + template + Proxy operator()(const FacetsIterator &beg, const FacetsIterator &end) const; +}; + diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/PlaneProxy.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/PlaneProxy.h deleted file mode 100644 index dfdc11e2b96..00000000000 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/PlaneProxy.h +++ /dev/null @@ -1,47 +0,0 @@ - -/*! -\ingroup PkgTSMAConcepts -\cgalConcept - -The parameterized plane shape that is fitted. - -\cgalRefines `Proxy` -\cgalHasModel `PlaneProxy` - -*/ -class PlaneProxy { -public: - /*! 3D point type - * It must be default constructible, and can be constructed from 3 objects of type `FT`. - * `bool operator<(Point_3, Point_3)` to lexicographically compare two points must be available. - * Access to Cartesian coordinates must be possible using `Point_3::x()`, `Point_3::y(), Point_3::z()` and - * `FT operator[](int i)` with `0 <= i < 3`. - * - * There must be a specialization of `CGAL::Kernel_traits` such that - * `CGAL::Kernel_traits::%Kernel` is a model implementing this concept. - */ - typedef unspecified_type Point_3; - - /// 3D vector type - typedef unspecified_type Vector_3; - /// 3D plane type - typedef unspecified_type Plane_3; - - /// Triangle mesh facet descriptor. - typedef unspecified_type facet_descriptor; - - /// @name Data members - /// @{ - - /// data member to describe the plane proxy center position. - Point_3 center; - /// data member to describe the plane proxy normal. - Vector_3 normal; - /// data member to describe the proxy seed. - facet_descriptor seed; - /// data member to describe the fitted plane. - Plane_3 fit_plane; - - /// } -}; - diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/Proxy.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/Proxy.h index dfcd15e38ba..3adee0b322d 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/Proxy.h +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/Proxy.h @@ -6,7 +6,6 @@ The parameterized shape that is fitted. \cgalHasModel `PlaneProxy` -\cgalHasModel `DistanceProxy` */ class Proxy { diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ProxyFitting.h b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ProxyFitting.h new file mode 100644 index 00000000000..79cc3e86d94 --- /dev/null +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Concepts/ProxyFitting.h @@ -0,0 +1,16 @@ +/*! +\ingroup PkgTSMAConcepts +\cgalConcept + +The function object class to fit a proxy from a range of facets. + +\cgalHasModel `L21ProxyFitting` +\cgalHasModel `L2ProxyFitting` + +*/ +class PlaneFitting { + typedef unspecified_type Proxy; + + template + Proxy operator()(const FacetsIterator &beg, const FacetsIterator &end) const; +}; diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt index 0c415fea97c..3a6baf6e4a0 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt @@ -24,13 +24,13 @@ ## Concepts ## - `Proxy` -- `DistanceProxy` -- `PlaneProxy` - `ErrorMetric` -- `L21ErrorMetric` +- `ProxyFitting` +- `PlaneFitting` ## Classes and Functions## -- `CGAL::vsa_mesh_approximation()` - +- `CGAL::vsa_approximate()` +- `CGAL::vsa_extract()` +- `CGAL::vsa_approximate_and_extract()` */ 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 587612b5604..cc4446dee46 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 @@ -18,19 +18,21 @@ This package can thus be used either with `Polyhedron_3`, `Surface_mesh`, or any class model of the concept `FaceGraph` described in \ref chapterBGL. Approximate a triangle mesh and extract the approximated triangle surface, using: -- `CGAL::vsa_mesh_approximation()` : given a triangle mesh, approximate the geometry and extract the approximated triangle surface. +- `CGAL::vsa_approximate()` : given a triangle mesh, approximate the geometry and output the facet proxy index map. +- `CGAL::vsa_extract()` : given a triangle mesh, approximate the geometry and output the approximated triangle surface. +- `CGAL::vsa_approximate_and_extract()` : given a triangle mesh, approximate the geometry, output the facet proxy index map and extract the approximated triangle surface. \section sma_examples Examples \subsection ApproximationExample_1 Approximate a Mesh -The following example calls the functions `CGAL::vsa_mesh_approximation()` on the input triangle mesh. +The following example calls the functions `CGAL::vsa_extract()` on the input triangle mesh. \cgalExample{Surface_mesh_approximation/vsa_extraction_example.cpp} \subsection ApproximationExample_2 User-defined Proxy -We could use self-defined proxy and error for the approximation algorithm. In the following example, we define a simple point proxy to achieve a compact patch approximation of the shape: +We could use self-defined proxy and error for the approximation algorithm. In the following example, we define a simple point-wise proxy to achieve a compact patch approximation of the shape: \cgalExample{Surface_mesh_approximation/vsa_metric_example.cpp} diff --git a/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h b/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h index 7645bddeefa..29cf8f6b323 100644 --- a/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h @@ -40,6 +40,7 @@ namespace CGAL * @param pos anchor position container * @param vtx anchor vertex container * @param bdrs proxy patch boundary container + * @param plane_fitting plane fitting functor * @param fit_error error metric functor * @param proxy_fitting proxy fitting functor */ @@ -64,7 +65,7 @@ void vsa_mesh_approximation( AnchorPositionContainer &pos, AnchorVertexContainer &vtx, BoundaryContainer &bdrs, - const PlaneFitting &_plane_fitting, + const PlaneFitting &plane_fitting, const ErrorMetric &fit_error, const ProxyFitting &proxy_fitting) { // CGAL_precondition(is_pure_triangle(tm)); @@ -83,7 +84,7 @@ void vsa_mesh_approximation( PlaneFitting, VertexPointMap> VSA_mesh_extraction; - VSA_mesh_extraction extractor(tm, f_proxy_pmap, _plane_fitting, v_point_pmap); + VSA_mesh_extraction extractor(tm, f_proxy_pmap, plane_fitting, v_point_pmap); extractor.extract_mesh(tris); BOOST_FOREACH(const typename VSA_mesh_extraction::Anchor &a, extractor.collect_anchors()) { @@ -167,6 +168,7 @@ void vsa_approximate( * @param tm a triangle mesh * @param[out] tris approximation indexed triangle soup * @param[out] pos anchor position container + * @param plane_fitting plane fitting functor * @param fit_error error metric functor * @param proxy_fitting proxy fitting functor * @param init select seed initialization @@ -183,7 +185,7 @@ void vsa_extract( const TriangleMesh &tm, AnchorIndexContainer &tris, AnchorPositionContainer &pos, - const PlaneFitting &_plane_fitting, + const PlaneFitting &plane_fitting, const ErrorMetric &fit_error, const ProxyFitting &proxy_fitting, const int init, @@ -211,7 +213,7 @@ void vsa_extract( FacetProxyMap, PlaneFitting> VSA_mesh_extraction; - VSA_mesh_extraction extractor(tm, f_proxy_pmap, _plane_fitting); + VSA_mesh_extraction extractor(tm, f_proxy_pmap, plane_fitting); extractor.extract_mesh(tris); BOOST_FOREACH(const typename VSA_mesh_extraction::Anchor &a, extractor.collect_anchors()) @@ -238,6 +240,7 @@ void vsa_extract( * @param[out] f_proxy_pmap facet proxy patch id property map * @param[out] tris approximation indexed triangle soup * @param[out] pos anchor position container + * @param plane_fitting plane fitting functor * @param fit_error error metric functor * @param proxy_fitting proxy fitting functor * @param init select seed initialization @@ -256,7 +259,7 @@ void vsa_approximate_and_extract( FacetProxyMap f_proxy_pmap, AnchorIndexContainer &tris, AnchorPositionContainer &pos, - const PlaneFitting &_plane_fitting, + const PlaneFitting &plane_fitting, const ErrorMetric &fit_error, const ProxyFitting &proxy_fitting, const int init, @@ -277,7 +280,7 @@ void vsa_approximate_and_extract( FacetProxyMap, PlaneFitting> VSA_mesh_extraction; - VSA_mesh_extraction extractor(tm, f_proxy_pmap, _plane_fitting); + VSA_mesh_extraction extractor(tm, f_proxy_pmap, plane_fitting); extractor.extract_mesh(tris); BOOST_FOREACH(const typename VSA_mesh_extraction::Anchor &a, extractor.collect_anchors())