bugfix to avoid assuming Monge_via_jet_fitting has default template parameters

This commit is contained in:
Sébastien Loriot 2014-01-23 10:32:30 +01:00
parent 596e57a1b0
commit b2b7e5cb7c
5 changed files with 85 additions and 12 deletions

View File

@ -13,7 +13,7 @@ the particular information returned depending on the degrees specified
for the polynomial fitting and for the Monge form.
If `CGAL_EIGEN3_ENABLED` is defined, `LocalKernel` and `SvdTraits`
template parameters have defaults, `Cartesian<double>` and `Eigen_svd` respectively.
template parameters have defaults, `Simple_cartesian<double>` and `Eigen_svd` respectively.
\tparam DataKernel provides the geometric classes and tools
corresponding to the input points, and also members of the

View File

@ -51,6 +51,7 @@ namespace internal {
///
/// @return Computed normal. Orientation is random.
template < typename Kernel,
typename SvdTraits,
typename Tree
>
typename Kernel::Vector_3
@ -68,7 +69,9 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute
typedef typename Neighbor_search::iterator Search_iterator;
// types for jet fitting
typedef typename CGAL::Monge_via_jet_fitting<Kernel> Monge_jet_fitting;
typedef Monge_via_jet_fitting< Kernel,
Simple_cartesian<double>,
SvdTraits> Monge_jet_fitting;
typedef typename Monge_jet_fitting::Monge_form Monge_form;
// Gather set of (k+1) neighboring points.
@ -114,19 +117,22 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute
///
/// \pre `k >= 2`
///
///
/// @tparam ForwardIterator iterator model of the concept of the same name over input points and able to store output normals.
/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
/// It can be omitted if ForwardIterator value_type is convertible to Point_3<Kernel>.
/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3<Kernel>.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
/// @tparam SvdTraits template parameter for the class `Monge_via_jet_fitting` that
/// can be ommited in conditions described in the documentation of `Monge_via_jet_fitting`.
// This variant requires all parameters.
template <typename ForwardIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel
typename Kernel,
typename SvdTraits
>
void
jet_estimate_normals(
@ -185,7 +191,7 @@ jet_estimate_normals(
// vectors (already normalized)
for(it = first; it != beyond; it++)
{
Vector normal = internal::jet_estimate_normal<Kernel,Tree>(
Vector normal = internal::jet_estimate_normal<Kernel,SvdTraits,Tree>(
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
get(point_pmap,it),
#else
@ -205,6 +211,32 @@ jet_estimate_normals(
CGAL_TRACE("End of jet_estimate_normals()\n");
}
#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
/// @cond SKIP_IN_MANUAL
template <typename ForwardIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel
>
void
jet_estimate_normals(
ForwardIterator first,
ForwardIterator beyond,
PointPMap point_pmap,
NormalPMap normal_pmap,
unsigned int k,
const Kernel& kernel,
unsigned int degree_fitting = 2)
{
#ifdef CGAL_EIGEN3_ENABLED
typedef Eigen_svd SvdTraits;
#else
typedef Lapack_svd SvdTraits;
#endif
jet_estimate_normals<ForwardIterator,PointPMap,NormalPMap,Kernel,SvdTraits>(
first, beyond, point_pmap, normal_pmap, k, kernel, degree_fitting);
}
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
template <typename ForwardIterator,
@ -258,7 +290,7 @@ jet_estimate_normals(
degree_fitting);
}
/// @endcond
#endif
} //namespace CGAL

View File

@ -50,7 +50,9 @@ namespace internal {
///
/// @return computed point
template <typename Kernel,
typename Tree>
typename SvdTraits,
typename Tree
>
typename Kernel::Point_3
jet_smooth_point(
const typename Kernel::Point_3& query, ///< 3D point to project
@ -68,7 +70,9 @@ jet_smooth_point(
typedef typename Neighbor_search::iterator Search_iterator;
// types for jet fitting
typedef typename CGAL::Monge_via_jet_fitting<Kernel> Monge_jet_fitting;
typedef Monge_via_jet_fitting< Kernel,
Simple_cartesian<double>,
SvdTraits> Monge_jet_fitting;
typedef typename Monge_jet_fitting::Monge_form Monge_form;
// Gather set of (k+1) neighboring points.
@ -119,11 +123,14 @@ jet_smooth_point(
/// It can be omitted if InputIterator value_type is convertible to Point_3<Kernel>.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
/// @tparam SvdTraits template parameter for the class `Monge_via_jet_fitting` that
/// can be ommited in conditions described in the documentation of `Monge_via_jet_fitting`.
// This variant requires all parameters.
template <typename InputIterator,
typename PointPMap,
typename Kernel
typename Kernel,
typename SvdTraits
>
void
jet_smooth_point_set(
@ -174,15 +181,43 @@ jet_smooth_point_set(
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
const Point& p = get(point_pmap, it);
put(point_pmap, it ,
internal::jet_smooth_point<Kernel>(p,tree,k,degree_fitting,degree_monge) );
internal::jet_smooth_point<Kernel, SvdTraits>(
p,tree,k,degree_fitting,degree_monge) );
#else
const Point& p = get(point_pmap, *it);
put(point_pmap, *it ,
internal::jet_smooth_point<Kernel>(p,tree,k,degree_fitting,degree_monge) );
internal::jet_smooth_point<Kernel, SvdTraits>(
p,tree,k,degree_fitting,degree_monge) );
#endif
}
}
#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
/// @cond SKIP_IN_MANUAL
template <typename InputIterator,
typename PointPMap,
typename Kernel
>
void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const Kernel& kernel, ///< geometric traits.
unsigned int degree_fitting = 2, ///< fitting degree
unsigned int degree_monge = 2) ///< Monge degree
{
#ifdef CGAL_EIGEN3_ENABLED
typedef Eigen_svd SvdTraits;
#else
typedef Lapack_svd SvdTraits;
#endif
jet_smooth_point_set<InputIterator, PointPMap, Kernel, SvdTraits>(
first, beyond, point_pmap, k, kernel, degree_fitting, degree_monge);
}
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
template <typename InputIterator,
@ -232,7 +267,7 @@ jet_smooth_point_set(
degree_fitting,degree_monge);
}
/// @endcond
#endif
} //namespace CGAL

View File

@ -53,6 +53,7 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" )
create_single_source_cgal_program( "analysis_test.cpp" )
create_single_source_cgal_program( "remove_outliers_test.cpp" )
create_single_source_cgal_program( "psp_jet_includes.cpp" )
# Use Eigen or BLAS and LAPACK (optional)
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)

View File

@ -0,0 +1,5 @@
#include <CGAL/jet_smooth_point_set.h>
#include <CGAL/jet_estimate_normals.h>
int main()
{}