diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt index 73a8c111467..695008f4fdf 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/PackageDescription.txt @@ -39,7 +39,6 @@ and provides the list of parameters used in this package. ## Classes ## - `CGAL::VSA::L21_metric_vector_proxy` -- `CGAL::VSA::L21_metric_vector_proxy_no_area_weighting` - `CGAL::VSA::L2_metric_plane_proxy` - `CGAL::VSA_approximation` 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 349e188c49c..a04301e3dc1 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 @@ -175,7 +175,7 @@ The input of the algorithm is expected to be: \subsection sma_example1 Free Function Approximation -The following example calls the free function `CGAL::mesh_approximation()` on the input triangle mesh with default `CGAL::VSA::L21_metric_plane_proxy_no_area_weighting`. +The following example calls the free function `CGAL::mesh_approximation()` on the input triangle mesh with default `CGAL::VSA::L21_metric_vector_proxy`. \cgalExample{Surface_mesh_approximation/vsa_approximation_example.cpp} diff --git a/Surface_mesh_approximation/include/CGAL/L21_metric_vector_proxy_no_area_weighting.h b/Surface_mesh_approximation/include/CGAL/L21_metric_vector_proxy_no_area_weighting.h deleted file mode 100644 index 5f01af22fd5..00000000000 --- a/Surface_mesh_approximation/include/CGAL/L21_metric_vector_proxy_no_area_weighting.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef CGAL_L21_METRIC_VECTOR_PROXY_NO_AREA_WEIGHTING_H -#define CGAL_L21_METRIC_VECTOR_PROXY_NO_AREA_WEIGHTING_H - -#include - -#include -#include - -#include -#include - -namespace CGAL { -namespace VSA { - -/// \ingroup PkgTSMA -/// @brief Approximation L21 metric of vector proxy without area weighting. -/// -/// \cgalModels `ErrorMetricProxy` -/// -/// @tparam TriangleMesh a triangle `FaceListGraph` -/// @tparam VertexPointMap a property map with `boost::graph_traits::%vertex_descriptor` -/// as key type, GeomTraits::Point_3 as value type -/// @tparam GeomTraits geometric traits -template ::type, - typename GeomTraits - = typename TriangleMesh::Traits> -class L21_metric_vector_proxy_no_area_weighting { - typedef typename GeomTraits::FT FT; - typedef typename GeomTraits::Vector_3 Vector_3; - typedef typename GeomTraits::Point_3 Point_3; - typedef typename GeomTraits::Construct_scaled_vector_3 Construct_scaled_vector_3; - typedef typename GeomTraits::Construct_sum_of_vectors_3 Construct_sum_of_vectors_3; - typedef typename GeomTraits::Compute_scalar_product_3 Compute_scalar_product_3; - - typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - - typedef typename boost::property_map::type Vertex_point_map; - - typedef CGAL::internal::face_property_t Face_normal_tag; - typedef CGAL::internal::face_property_t Face_area_tag; - typedef typename CGAL::internal::dynamic_property_map::type Face_normal_map; - typedef typename CGAL::internal::dynamic_property_map::type Face_area_map; - -public: - /// \name Types - /// @{ - typedef typename GeomTraits::Vector_3 Proxy; - /// @} - - /// \name Constructor - /// @{ - /*! - * @brief Constructor - * @param tm triangle mesh - * @param vpmap vertex point map - */ - L21_metric_vector_proxy_no_area_weighting(const TriangleMesh &tm, const VertexPointMap &vpmap) { - GeomTraits traits; - m_scalar_product_functor = traits.compute_scalar_product_3_object(); - m_sum_functor = traits.construct_sum_of_vectors_3_object(); - m_scale_functor = traits.construct_scaled_vector_3_object(); - - m_fnmap = CGAL::internal::add_property( - Face_normal_tag("VSA-face_normal"), const_cast(tm)); - - // construct internal facet normal & area map - BOOST_FOREACH(face_descriptor f, faces(tm)) { - const halfedge_descriptor he = halfedge(f, tm); - const Point_3 &p0 = vpmap[source(he, tm)]; - const Point_3 &p1 = vpmap[target(he, tm)]; - const Point_3 &p2 = vpmap[target(next(he, tm), tm)]; - put(m_fnmap, f, CGAL::unit_normal(p0, p1, p2)); - } - } - /// @} - - /// \name Operations - /*! - * @brief Computes the L2,1 error from a facet to a proxy. - * @param f face_descriptor of a face - * @param px proxy - * @return computed error - */ - FT compute_error(const face_descriptor &f, const Proxy &px) const { - Vector_3 v = m_sum_functor(get(m_fnmap, f), m_scale_functor(px, FT(-1.0))); - return m_scalar_product_functor(v, v); - } - - /*! - * @brief Fits a proxy to a face range. - * @param beg face range begin - * @param end face range end - * @return fitted proxy - */ - template - Proxy fit_proxy(const FacetIterator beg, const FacetIterator end) const { - CGAL_assertion(beg != end); - - // fitting normal - Vector_3 norm = CGAL::NULL_VECTOR; - for (FacetIterator fitr = beg; fitr != end; ++fitr) { - norm = m_sum_functor(norm, get(m_fnmap, *fitr)); - } - norm = m_scale_functor(norm, - FT(1.0 / std::sqrt(CGAL::to_double(norm.squared_length())))); - - return norm; - } - /// @} - -private: - Face_normal_map m_fnmap; - Construct_scaled_vector_3 m_scale_functor; - Compute_scalar_product_3 m_scalar_product_functor; - Construct_sum_of_vectors_3 m_sum_functor; -}; - -} // namespace VSA -} // namespace CGAL - -#endif // CGAL_L21_METRIC_VECTOR_PROXY_NO_AREA_WEIGHTING_H diff --git a/Surface_mesh_approximation/include/CGAL/VSA_approximation.h b/Surface_mesh_approximation/include/CGAL/VSA_approximation.h index 01d1fb6f75a..eed4e6429ce 100644 --- a/Surface_mesh_approximation/include/CGAL/VSA_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/VSA_approximation.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include @@ -88,7 +88,7 @@ public: // ErrorMetric type #ifndef DOXYGEN_RUNNING typedef typename CGAL::Default::Get >::type Error_metric; + CGAL::VSA::L21_metric_vector_proxy >::type Error_metric; #else typedef ErrorMetric Error_metric; #endif diff --git a/Surface_mesh_approximation/include/CGAL/mesh_approximation.h b/Surface_mesh_approximation/include/CGAL/mesh_approximation.h index db409c0c0ff..8881c8fe8b8 100644 --- a/Surface_mesh_approximation/include/CGAL/mesh_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/mesh_approximation.h @@ -112,7 +112,6 @@ bool mesh_approximation(const TriangleMesh &tm, const NamedParameters &np) Vertex_point_map point_pmap = choose_param(get_param(np, internal_np::vertex_point), get_property_map(vertex_point, const_cast(tm))); - typedef CGAL::VSA::L21_metric_vector_proxy_no_area_weighting L21_metric; typedef CGAL::VSA_approximation L21_approx; typedef L21_approx::Error_metric L21_metric;