fix concepts

This commit is contained in:
Lingjie Zhu 2017-07-30 17:39:52 +08:00
parent f031ae3800
commit 96180101ac
10 changed files with 54 additions and 148 deletions

View File

@ -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<Point_3>::%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;
/// }
};

View File

@ -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 {

View File

@ -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);
/// }
};

View File

@ -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<FacetsIterator>
Proxy operator()(const FacetsIterator &beg, const FacetsIterator &end) const;
};

View File

@ -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<Point_3>::%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;
/// }
};

View File

@ -6,7 +6,6 @@
The parameterized shape that is fitted.
\cgalHasModel `PlaneProxy`
\cgalHasModel `DistanceProxy`
*/
class Proxy {

View File

@ -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<FacetsIterator>
Proxy operator()(const FacetsIterator &beg, const FacetsIterator &end) const;
};

View File

@ -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()`
*/

View File

@ -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}

View File

@ -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())