mirror of https://github.com/CGAL/cgal
Replaced uses of ::result_type and ::argument_type in Interpolation
This allows to pass more generic functors such as lambdas, for example.
This commit is contained in:
parent
77ab3dbd00
commit
c76dace89b
|
|
@ -27,6 +27,8 @@
|
||||||
#include <CGAL/double.h>
|
#include <CGAL/double.h>
|
||||||
#include <CGAL/use.h>
|
#include <CGAL/use.h>
|
||||||
|
|
||||||
|
#include <boost/utility/result_of.hpp>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -58,17 +60,21 @@ struct Data_access
|
||||||
|
|
||||||
//the interpolation functions:
|
//the interpolation functions:
|
||||||
template < class ForwardIterator, class ValueFunctor >
|
template < class ForwardIterator, class ValueFunctor >
|
||||||
typename ValueFunctor::result_type::first_type
|
typename boost::result_of<
|
||||||
|
ValueFunctor(typename std::iterator_traits<ForwardIterator>::value_type::first_type)>
|
||||||
|
::type::first_type
|
||||||
linear_interpolation(ForwardIterator first, ForwardIterator beyond,
|
linear_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
||||||
ValueFunctor value_function)
|
ValueFunctor value_function)
|
||||||
{
|
{
|
||||||
CGAL_precondition(norm > 0);
|
CGAL_precondition(norm > 0);
|
||||||
|
|
||||||
typedef typename ValueFunctor::result_type::first_type Value_type;
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type result_type;
|
||||||
|
typedef typename result_type::first_type Value_type;
|
||||||
|
|
||||||
Value_type result(0);
|
Value_type result(0);
|
||||||
typename ValueFunctor::result_type val;
|
result_type val;
|
||||||
for(; first!=beyond; ++first)
|
for(; first!=beyond; ++first)
|
||||||
{
|
{
|
||||||
val = value_function(first->first);
|
val = value_function(first->first);
|
||||||
|
|
@ -78,9 +84,12 @@ linear_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template < class ForwardIterator, class ValueFunctor, class GradFunctor, class Traits, class Point >
|
template < class ForwardIterator, class ValueFunctor, class GradFunctor, class Traits, class Point >
|
||||||
std::pair< typename ValueFunctor::result_type::first_type, bool>
|
std::pair<
|
||||||
|
typename boost::result_of<
|
||||||
|
ValueFunctor(typename std::iterator_traits<ForwardIterator>::value_type::first_type)>
|
||||||
|
::type::first_type,
|
||||||
|
bool>
|
||||||
quadratic_interpolation(ForwardIterator first, ForwardIterator beyond,
|
quadratic_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
||||||
const Point& p,
|
const Point& p,
|
||||||
|
|
@ -89,15 +98,20 @@ quadratic_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
const Traits& traits)
|
const Traits& traits)
|
||||||
{
|
{
|
||||||
CGAL_precondition(norm > 0);
|
CGAL_precondition(norm > 0);
|
||||||
typedef typename ValueFunctor::result_type::first_type Value_type;
|
|
||||||
typedef typename Traits::Point_d Bare_point;
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
|
typedef typename boost::result_of<GradFunctor(arg_type)>::type gradient_functor_result_type;
|
||||||
|
typedef typename value_functor_result_type::first_type Value_type;
|
||||||
|
|
||||||
|
typedef typename Traits::Point_d Bare_point;
|
||||||
|
|
||||||
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
||||||
const Bare_point& bp = cp(p);
|
const Bare_point& bp = cp(p);
|
||||||
|
|
||||||
Value_type result(0);
|
Value_type result(0);
|
||||||
typename ValueFunctor::result_type f;
|
value_functor_result_type f;
|
||||||
typename GradFunctor::result_type grad;
|
gradient_functor_result_type grad;
|
||||||
|
|
||||||
for(; first!=beyond; ++first)
|
for(; first!=beyond; ++first)
|
||||||
{
|
{
|
||||||
|
|
@ -119,7 +133,11 @@ quadratic_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
|
|
||||||
|
|
||||||
template < class ForwardIterator, class ValueFunctor, class GradFunctor, class Traits, class Point >
|
template < class ForwardIterator, class ValueFunctor, class GradFunctor, class Traits, class Point >
|
||||||
std::pair< typename ValueFunctor::result_type::first_type, bool >
|
std::pair<
|
||||||
|
typename boost::result_of<
|
||||||
|
ValueFunctor(typename std::iterator_traits<ForwardIterator>::value_type::first_type)>
|
||||||
|
::type::first_type,
|
||||||
|
bool>
|
||||||
sibson_c1_interpolation(ForwardIterator first, ForwardIterator beyond,
|
sibson_c1_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
||||||
const Point& p,
|
const Point& p,
|
||||||
|
|
@ -129,17 +147,21 @@ sibson_c1_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
{
|
{
|
||||||
CGAL_precondition(norm >0);
|
CGAL_precondition(norm >0);
|
||||||
|
|
||||||
typedef typename ValueFunctor::result_type::first_type Value_type;
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
typedef typename Traits::FT Coord_type;
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
typedef typename Traits::Point_d Bare_point;
|
typedef typename boost::result_of<GradFunctor(arg_type)>::type gradient_functor_result_type;
|
||||||
|
typedef typename value_functor_result_type::first_type Value_type;
|
||||||
|
|
||||||
|
typedef typename Traits::FT Coord_type;
|
||||||
|
typedef typename Traits::Point_d Bare_point;
|
||||||
|
|
||||||
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
||||||
const Bare_point& bp = cp(p);
|
const Bare_point& bp = cp(p);
|
||||||
|
|
||||||
Coord_type term1(0), term2(term1), term3(term1), term4(term1);
|
Coord_type term1(0), term2(term1), term3(term1), term4(term1);
|
||||||
Value_type linear_int(0), gradient_int(0);
|
Value_type linear_int(0), gradient_int(0);
|
||||||
typename ValueFunctor::result_type f;
|
value_functor_result_type f;
|
||||||
typename GradFunctor::result_type grad;
|
gradient_functor_result_type grad;
|
||||||
|
|
||||||
for(; first!=beyond; ++first)
|
for(; first!=beyond; ++first)
|
||||||
{
|
{
|
||||||
|
|
@ -193,7 +215,11 @@ sibson_c1_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||||
// gradient_int += (coeff/inv_weight) * (vh->get_value()+ vh->get_gradient() * (p - vh->point()));
|
// gradient_int += (coeff/inv_weight) * (vh->get_value()+ vh->get_gradient() * (p - vh->point()));
|
||||||
|
|
||||||
template < class ForwardIterator, class ValueFunctor, class GradFunctor, class Traits, class Point >
|
template < class ForwardIterator, class ValueFunctor, class GradFunctor, class Traits, class Point >
|
||||||
std::pair< typename ValueFunctor::result_type::first_type, bool >
|
std::pair<
|
||||||
|
typename boost::result_of<
|
||||||
|
ValueFunctor(typename std::iterator_traits<ForwardIterator>::value_type::first_type)>
|
||||||
|
::type::first_type,
|
||||||
|
bool>
|
||||||
sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator beyond,
|
sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator beyond,
|
||||||
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
||||||
const Point& p,
|
const Point& p,
|
||||||
|
|
@ -203,17 +229,21 @@ sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator beyond,
|
||||||
{
|
{
|
||||||
CGAL_precondition(norm > 0);
|
CGAL_precondition(norm > 0);
|
||||||
|
|
||||||
typedef typename ValueFunctor::result_type::first_type Value_type;
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
typedef typename Traits::FT Coord_type;
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
typedef typename Traits::Point_d Bare_point;
|
typedef typename boost::result_of<GradFunctor(arg_type)>::type gradient_functor_result_type;
|
||||||
|
typedef typename value_functor_result_type::first_type Value_type;
|
||||||
|
|
||||||
|
typedef typename Traits::FT Coord_type;
|
||||||
|
typedef typename Traits::Point_d Bare_point;
|
||||||
|
|
||||||
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
||||||
const Bare_point& bp = cp(p);
|
const Bare_point& bp = cp(p);
|
||||||
|
|
||||||
Coord_type term1(0), term2(term1), term3(term1), term4(term1);
|
Coord_type term1(0), term2(term1), term3(term1), term4(term1);
|
||||||
Value_type linear_int(0), gradient_int(0);
|
Value_type linear_int(0), gradient_int(0);
|
||||||
typename ValueFunctor::result_type f;
|
value_functor_result_type f;
|
||||||
typename GradFunctor::result_type grad;
|
gradient_functor_result_type grad;
|
||||||
|
|
||||||
for(; first!=beyond; ++first)
|
for(; first!=beyond; ++first)
|
||||||
{
|
{
|
||||||
|
|
@ -257,7 +287,11 @@ sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator beyond,
|
||||||
|
|
||||||
template < class RandomAccessIterator, class ValueFunctor, class GradFunctor,
|
template < class RandomAccessIterator, class ValueFunctor, class GradFunctor,
|
||||||
class Traits, class Point_>
|
class Traits, class Point_>
|
||||||
std::pair< typename ValueFunctor::result_type::first_type, bool>
|
std::pair<
|
||||||
|
typename boost::result_of<
|
||||||
|
ValueFunctor(typename std::iterator_traits<RandomAccessIterator>::value_type::first_type)>
|
||||||
|
::type::first_type,
|
||||||
|
bool>
|
||||||
farin_c1_interpolation(RandomAccessIterator first,
|
farin_c1_interpolation(RandomAccessIterator first,
|
||||||
RandomAccessIterator beyond,
|
RandomAccessIterator beyond,
|
||||||
const typename std::iterator_traits<RandomAccessIterator>::value_type::second_type& norm,
|
const typename std::iterator_traits<RandomAccessIterator>::value_type::second_type& norm,
|
||||||
|
|
@ -268,14 +302,16 @@ farin_c1_interpolation(RandomAccessIterator first,
|
||||||
{
|
{
|
||||||
CGAL_precondition(norm >0);
|
CGAL_precondition(norm >0);
|
||||||
|
|
||||||
// the function value is available for all points
|
typedef typename std::iterator_traits<RandomAccessIterator>::value_type::first_type arg_type;
|
||||||
// if a gradient value is not availble: function returns false
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
typedef typename ValueFunctor::result_type::first_type Value_type;
|
typedef typename boost::result_of<GradFunctor(arg_type)>::type gradient_functor_result_type;
|
||||||
typedef typename Traits::FT Coord_type;
|
typedef typename value_functor_result_type::first_type Value_type;
|
||||||
|
|
||||||
|
typedef typename Traits::FT Coord_type;
|
||||||
|
|
||||||
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
Interpolation::internal::Extract_bare_point<Traits> cp(traits);
|
||||||
typename ValueFunctor::result_type f;
|
value_functor_result_type f;
|
||||||
typename GradFunctor::result_type grad;
|
gradient_functor_result_type grad;
|
||||||
|
|
||||||
int n = static_cast<int>(beyond - first);
|
int n = static_cast<int>(beyond - first);
|
||||||
if(n == 1)
|
if(n == 1)
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,11 @@
|
||||||
#include <CGAL/regular_neighbor_coordinates_2.h>
|
#include <CGAL/regular_neighbor_coordinates_2.h>
|
||||||
|
|
||||||
#include <CGAL/Origin.h>
|
#include <CGAL/Origin.h>
|
||||||
|
#include <CGAL/function.h>
|
||||||
|
|
||||||
#include <boost/mpl/if.hpp>
|
#include <boost/mpl/if.hpp>
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_constructible.hpp>
|
||||||
|
#include <boost/any.hpp>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
@ -45,12 +47,17 @@ sibson_gradient_fitting(ForwardIterator first,
|
||||||
ForwardIterator beyond,
|
ForwardIterator beyond,
|
||||||
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
const typename std::iterator_traits<ForwardIterator>::value_type::second_type& norm,
|
||||||
const Point& p,
|
const Point& p,
|
||||||
const typename ValueFunctor::result_type::first_type fn,
|
const typename boost::result_of<
|
||||||
|
ValueFunctor(typename std::iterator_traits<ForwardIterator>::value_type::first_type)>
|
||||||
|
::type::first_type fn,
|
||||||
ValueFunctor value_function,
|
ValueFunctor value_function,
|
||||||
const Traits& traits)
|
const Traits& traits)
|
||||||
{
|
{
|
||||||
CGAL_precondition( first != beyond && norm != 0);
|
CGAL_precondition( first != beyond && norm != 0);
|
||||||
|
|
||||||
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
|
|
||||||
typedef typename Traits::Aff_transformation_d Aff_transformation;
|
typedef typename Traits::Aff_transformation_d Aff_transformation;
|
||||||
typedef typename Traits::FT Coord_type;
|
typedef typename Traits::FT Coord_type;
|
||||||
typedef typename Traits::Point_d Bare_point;
|
typedef typename Traits::Point_d Bare_point;
|
||||||
|
|
@ -69,7 +76,7 @@ sibson_gradient_fitting(ForwardIterator first,
|
||||||
typename Traits::Vector_d d = traits.construct_vector_d_object()(bp, bare_f);
|
typename Traits::Vector_d d = traits.construct_vector_d_object()(bp, bare_f);
|
||||||
|
|
||||||
// compute the vector pn:
|
// compute the vector pn:
|
||||||
typename ValueFunctor::result_type f = value_function(first->first);
|
value_functor_result_type f = value_function(first->first);
|
||||||
CGAL_assertion(f.second); // function value of first->first is valid
|
CGAL_assertion(f.second); // function value of first->first is valid
|
||||||
pn = pn + traits.construct_scaled_vector_d_object()(d, scale * (f.first - fn));
|
pn = pn + traits.construct_scaled_vector_d_object()(d, scale * (f.first - fn));
|
||||||
|
|
||||||
|
|
@ -91,7 +98,10 @@ sibson_gradient_fitting(ForwardIterator first,
|
||||||
ValueFunctor value_function,
|
ValueFunctor value_function,
|
||||||
const Traits& traits)
|
const Traits& traits)
|
||||||
{
|
{
|
||||||
typename ValueFunctor::result_type fn = value_function(p);
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
|
|
||||||
|
value_functor_result_type fn = value_function(p);
|
||||||
CGAL_assertion(fn.second);
|
CGAL_assertion(fn.second);
|
||||||
|
|
||||||
return sibson_gradient_fitting(first, beyond, norm, p, fn.first, value_function, traits);
|
return sibson_gradient_fitting(first, beyond, norm, p, fn.first, value_function, traits);
|
||||||
|
|
@ -110,8 +120,11 @@ sibson_gradient_fitting_internal(ForwardIterator first,
|
||||||
const Traits& traits,
|
const Traits& traits,
|
||||||
const typename Traits::Point_d& /*dummy*/)
|
const typename Traits::Point_d& /*dummy*/)
|
||||||
{
|
{
|
||||||
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
|
|
||||||
const typename Traits::Point_d& bare_p = traits.construct_point_d_object()(vh->point());
|
const typename Traits::Point_d& bare_p = traits.construct_point_d_object()(vh->point());
|
||||||
typename ValueFunctor::result_type fn = value_function(bare_p);
|
value_functor_result_type fn = value_function(bare_p);
|
||||||
CGAL_assertion(fn.second);
|
CGAL_assertion(fn.second);
|
||||||
|
|
||||||
return sibson_gradient_fitting(first, beyond, norm, bare_p, fn.first, value_function, traits);
|
return sibson_gradient_fitting(first, beyond, norm, bare_p, fn.first, value_function, traits);
|
||||||
|
|
@ -129,7 +142,10 @@ sibson_gradient_fitting_internal(ForwardIterator first,
|
||||||
const Traits& traits,
|
const Traits& traits,
|
||||||
const typename Traits::Weighted_point_d& /*dummy*/)
|
const typename Traits::Weighted_point_d& /*dummy*/)
|
||||||
{
|
{
|
||||||
typename ValueFunctor::result_type fn = value_function(vh->point());
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
|
|
||||||
|
value_functor_result_type fn = value_function(vh->point());
|
||||||
CGAL_assertion(fn.second);
|
CGAL_assertion(fn.second);
|
||||||
|
|
||||||
return sibson_gradient_fitting(first, beyond, norm, vh->point(), fn.first, value_function, traits);
|
return sibson_gradient_fitting(first, beyond, norm, vh->point(), fn.first, value_function, traits);
|
||||||
|
|
@ -147,15 +163,19 @@ sibson_gradient_fitting_internal(ForwardIterator first,
|
||||||
const Traits& traits,
|
const Traits& traits,
|
||||||
VH /*dummy*/)
|
VH /*dummy*/)
|
||||||
{
|
{
|
||||||
|
typedef typename std::iterator_traits<ForwardIterator>::value_type::first_type arg_type;
|
||||||
|
typedef typename boost::result_of<ValueFunctor(arg_type)>::type value_functor_result_type;
|
||||||
|
|
||||||
const typename Traits::Point_d& bare_p = traits.construct_point_d_object()(vh->point());
|
const typename Traits::Point_d& bare_p = traits.construct_point_d_object()(vh->point());
|
||||||
typename ValueFunctor::result_type fn = value_function(vh);
|
value_functor_result_type fn = value_function(vh);
|
||||||
CGAL_assertion(fn.second);
|
CGAL_assertion(fn.second);
|
||||||
|
|
||||||
return sibson_gradient_fitting(first, beyond, norm, bare_p, fn.first, value_function, traits);
|
return sibson_gradient_fitting(first, beyond, norm, bare_p, fn.first, value_function, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template < class Tr, class OutputIterator, class OutputFunctor,
|
template < class ValueFunctorArgType,
|
||||||
|
class Tr, class OutputIterator, class OutputFunctor,
|
||||||
class ValueFunctor, class CoordFunctor, class Traits >
|
class ValueFunctor, class CoordFunctor, class Traits >
|
||||||
OutputIterator
|
OutputIterator
|
||||||
sibson_gradient_fitting_internal(const Tr& tr,
|
sibson_gradient_fitting_internal(const Tr& tr,
|
||||||
|
|
@ -170,7 +190,7 @@ sibson_gradient_fitting_internal(const Tr& tr,
|
||||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||||
|
|
||||||
Coord_type norm;
|
Coord_type norm;
|
||||||
std::vector<std::pair<typename ValueFunctor::argument_type, Coord_type> > coords;
|
std::vector<std::pair<ValueFunctorArgType, Coord_type> > coords;
|
||||||
|
|
||||||
typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin();
|
typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin();
|
||||||
for(; vit != tr.finite_vertices_end(); ++vit)
|
for(; vit != tr.finite_vertices_end(); ++vit)
|
||||||
|
|
@ -187,7 +207,7 @@ sibson_gradient_fitting_internal(const Tr& tr,
|
||||||
Vertex_handle(vit),
|
Vertex_handle(vit),
|
||||||
value_function,
|
value_function,
|
||||||
traits,
|
traits,
|
||||||
typename ValueFunctor::argument_type())));
|
ValueFunctorArgType())));
|
||||||
|
|
||||||
coords.clear();
|
coords.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +216,6 @@ sibson_gradient_fitting_internal(const Tr& tr,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// The following functions allow to fit the gradients for all points in
|
// The following functions allow to fit the gradients for all points in
|
||||||
// a triangulation except the convex hull points.
|
// a triangulation except the convex hull points.
|
||||||
// -> _nn2: natural_neighbor_coordinates_2
|
// -> _nn2: natural_neighbor_coordinates_2
|
||||||
|
|
@ -208,31 +227,56 @@ sibson_gradient_fitting_nn_2(const Dt& dt,
|
||||||
OutputIterator out,
|
OutputIterator out,
|
||||||
OutputFunctor fct,
|
OutputFunctor fct,
|
||||||
ValueFunctor value_function,
|
ValueFunctor value_function,
|
||||||
const Traits& traits)
|
const Traits& traits,
|
||||||
|
// Some SFINAE to distinguish whether the argument type
|
||||||
|
// of the value functor is 'DT::Point' or 'DT::Vertex_handle'
|
||||||
|
typename boost::enable_if_c<
|
||||||
|
boost::is_constructible<
|
||||||
|
cpp11::function<boost::any(typename Dt::Point)>,
|
||||||
|
ValueFunctor
|
||||||
|
>::value>::type* = NULL)
|
||||||
{
|
{
|
||||||
typedef typename Traits::FT FT;
|
typedef typename Traits::FT FT;
|
||||||
typedef typename ValueFunctor::argument_type VF_arg_type;
|
typedef typename Dt::Point VF_arg_type;
|
||||||
typedef typename std::back_insert_iterator<std::vector<
|
typedef typename std::back_insert_iterator<std::vector<
|
||||||
std::pair<VF_arg_type, FT> > > CoordInserter;
|
std::pair<VF_arg_type, FT> > > CoordInserter;
|
||||||
|
typedef Interpolation::internal::Extract_point_in_pair<Dt, FT> Coord_OutputFunctor;
|
||||||
|
|
||||||
// If the functor evaluates at points (and not vertices), then we must convert
|
return sibson_gradient_fitting_internal<VF_arg_type>(dt, out, fct, value_function,
|
||||||
// the output of the coordinates computations - a pair<vertex_handle, FT> -
|
natural_neighbor_coordinates_2_object<Dt,
|
||||||
// to a pair<point, FT>
|
CoordInserter,
|
||||||
typedef typename boost::mpl::if_<
|
Coord_OutputFunctor>(),
|
||||||
boost::is_same<VF_arg_type, typename Dt::Point>,
|
traits);
|
||||||
Interpolation::internal::Extract_point_in_pair<Dt, FT>,
|
|
||||||
CGAL::Identity<std::pair<VF_arg_type, FT> >
|
|
||||||
>::type Coord_OutputFunctor;
|
|
||||||
|
|
||||||
return sibson_gradient_fitting_internal(dt, out, fct, value_function,
|
|
||||||
natural_neighbor_coordinates_2_object<Dt,
|
|
||||||
CoordInserter,
|
|
||||||
Coord_OutputFunctor>(),
|
|
||||||
traits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < class Dt, class OutputIterator, class OutputFunctor, class ValueFunctor, class Traits >
|
||||||
|
OutputIterator
|
||||||
|
sibson_gradient_fitting_nn_2(const Dt& dt,
|
||||||
|
OutputIterator out,
|
||||||
|
OutputFunctor fct,
|
||||||
|
ValueFunctor value_function,
|
||||||
|
const Traits& traits,
|
||||||
|
typename boost::enable_if_c<
|
||||||
|
boost::is_constructible<
|
||||||
|
cpp11::function<boost::any(typename Dt::Vertex_handle)>,
|
||||||
|
ValueFunctor
|
||||||
|
>::value>::type* = NULL)
|
||||||
|
{
|
||||||
|
typedef typename Traits::FT FT;
|
||||||
|
typedef typename Dt::Vertex_handle VF_arg_type;
|
||||||
|
typedef typename std::back_insert_iterator<std::vector<
|
||||||
|
std::pair<VF_arg_type, FT> > > CoordInserter;
|
||||||
|
typedef CGAL::Identity<std::pair<VF_arg_type, FT> > Coord_OutputFunctor;
|
||||||
|
|
||||||
// Same as above but without OutputFunctor. Default to extracting the point, for backward compatibility.
|
return sibson_gradient_fitting_internal<VF_arg_type>(dt, out, fct, value_function,
|
||||||
|
natural_neighbor_coordinates_2_object<Dt,
|
||||||
|
CoordInserter,
|
||||||
|
Coord_OutputFunctor>(),
|
||||||
|
traits);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Same as above but without OutputFunctor.
|
||||||
|
// Defaults to extracting the point, for backward compatibility.
|
||||||
template < class Dt, class OutputIterator, class ValueFunctor, class Traits >
|
template < class Dt, class OutputIterator, class ValueFunctor, class Traits >
|
||||||
OutputIterator
|
OutputIterator
|
||||||
sibson_gradient_fitting_nn_2(const Dt& dt,
|
sibson_gradient_fitting_nn_2(const Dt& dt,
|
||||||
|
|
@ -246,6 +290,33 @@ sibson_gradient_fitting_nn_2(const Dt& dt,
|
||||||
return sibson_gradient_fitting_nn_2(dt, out, OutputFunctor(), value_function, traits);
|
return sibson_gradient_fitting_nn_2(dt, out, OutputFunctor(), value_function, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < class Rt, class OutputIterator, class OutputFunctor, class ValueFunctor, class Traits >
|
||||||
|
OutputIterator
|
||||||
|
sibson_gradient_fitting_rn_2(const Rt& rt,
|
||||||
|
OutputIterator out,
|
||||||
|
OutputFunctor fct,
|
||||||
|
ValueFunctor value_function,
|
||||||
|
const Traits& traits,
|
||||||
|
// Some SFINAE to distinguish whether the argument type
|
||||||
|
// of the value functor is 'Rt::Point' (weighted point) or 'Rt::Vertex_handle'
|
||||||
|
typename boost::enable_if_c<
|
||||||
|
boost::is_constructible<
|
||||||
|
cpp11::function<boost::any(typename Rt::Point)>,
|
||||||
|
ValueFunctor
|
||||||
|
>::value>::type* = NULL)
|
||||||
|
{
|
||||||
|
typedef typename Traits::FT FT;
|
||||||
|
typedef typename Rt::Point VF_arg_type;
|
||||||
|
typedef typename std::back_insert_iterator<std::vector<
|
||||||
|
std::pair<VF_arg_type, FT> > > CoordInserter;
|
||||||
|
typedef Interpolation::internal::Extract_point_in_pair<Rt, FT> Coord_OutputFunctor;
|
||||||
|
|
||||||
|
return sibson_gradient_fitting_internal<VF_arg_type>(rt, out, fct, value_function,
|
||||||
|
regular_neighbor_coordinates_2_object<Rt,
|
||||||
|
CoordInserter,
|
||||||
|
Coord_OutputFunctor>(),
|
||||||
|
traits);
|
||||||
|
}
|
||||||
|
|
||||||
template < class Rt, class OutputIterator, class OutputFunctor, class ValueFunctor, class Traits >
|
template < class Rt, class OutputIterator, class OutputFunctor, class ValueFunctor, class Traits >
|
||||||
OutputIterator
|
OutputIterator
|
||||||
|
|
@ -253,30 +324,26 @@ sibson_gradient_fitting_rn_2(const Rt& rt,
|
||||||
OutputIterator out,
|
OutputIterator out,
|
||||||
OutputFunctor fct,
|
OutputFunctor fct,
|
||||||
ValueFunctor value_function,
|
ValueFunctor value_function,
|
||||||
const Traits& traits)
|
const Traits& traits,
|
||||||
|
typename boost::enable_if_c<
|
||||||
|
boost::is_constructible<
|
||||||
|
cpp11::function<boost::any(typename Rt::Vertex_handle)>,
|
||||||
|
ValueFunctor
|
||||||
|
>::value>::type* = NULL)
|
||||||
{
|
{
|
||||||
typedef typename Traits::FT FT;
|
typedef typename Traits::FT FT;
|
||||||
typedef typename ValueFunctor::argument_type VF_arg_type;
|
typedef typename Rt::Vertex_handle VF_arg_type;
|
||||||
typedef typename std::back_insert_iterator<std::vector<
|
typedef typename std::back_insert_iterator<std::vector<
|
||||||
std::pair<VF_arg_type, FT> > > CoordInserter;
|
std::pair<VF_arg_type, FT> > > CoordInserter;
|
||||||
|
typedef CGAL::Identity<std::pair<VF_arg_type, FT> > Coord_OutputFunctor;
|
||||||
|
|
||||||
// If the functor evaluates at points (and not vertices), then we must convert
|
return sibson_gradient_fitting_internal<VF_arg_type>(rt, out, fct, value_function,
|
||||||
// the output of the coordinates computations - a pair<vertex_handle, FT> -
|
regular_neighbor_coordinates_2_object<Rt,
|
||||||
// to a pair<point, FT>
|
CoordInserter,
|
||||||
typedef typename boost::mpl::if_<
|
Coord_OutputFunctor>(),
|
||||||
boost::is_same<VF_arg_type, typename Rt::Weighted_point>,
|
traits);
|
||||||
Interpolation::internal::Extract_point_in_pair<Rt, FT>,
|
|
||||||
CGAL::Identity<std::pair<VF_arg_type, FT> >
|
|
||||||
>::type Coord_OutputFunctor;
|
|
||||||
|
|
||||||
return sibson_gradient_fitting_internal(rt, out, fct, value_function,
|
|
||||||
regular_neighbor_coordinates_2_object<Rt,
|
|
||||||
CoordInserter,
|
|
||||||
Coord_OutputFunctor>(),
|
|
||||||
traits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Same as above but without OutputFunctor. Default to extracting the point, for backward compatibility.
|
// Same as above but without OutputFunctor. Default to extracting the point, for backward compatibility.
|
||||||
template < class Rt, class OutputIterator, class ValueFunctor, class Traits >
|
template < class Rt, class OutputIterator, class ValueFunctor, class Traits >
|
||||||
OutputIterator
|
OutputIterator
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue