CGAL::linear_interpolation

Definition

The function linear_interpolation computes the weighted sum of the function values which must be provided via a functor.

#include <CGAL/interpolation_functions.h>

template < class ForwardIterator, class Functor>
typename Functor::result_type::first_type
linear_interpolation ( ForwardIterator first,
ForwardIterator beyond,
typename std::iterator_traits<ForwardIterator>::value_type::second_type norm,
Functor function_values)
ForwardIterator::value_type is a pair associating a point to a (non-normalized) barycentric coordinate. norm is the normalization factor. Given a point, the functor function_values allows to access a pair of a function value and a Boolean. The Boolean indicates whether the function value could be retrieved correctly. This function generates the interpolated function value as the weighted sum of the values corresponding to each point of the point/coordinate pairs in the range [.first, beyond.).
Precondition: norm 0. function_value(p).second == true for all points p of the point/coordinate pairs in the range [.first, beyond.).

Requirements

  1. ForwardIterator::value_type is a pair of point/coordinate value, thus ForwardIterator::value_type::first_type is equivalent to a point and ForwardIterator::value_type::second_type is a field number type.
  2. Functor::argument_type must be equivalent to ForwardIterator::value_type::first_type and Functor::result_type is a pair of the function value type and a Boolean value. The function value type must provide a multiplication and addition operation with the field number type ForwardIterator::value_type::second_type and a constructor with argument 0. A model of the functor is provided by the struct Data_access. It must be instantiated accordingly with an associative container (e.g. STL std::map) having the point type as key_type and the function value type as mapped_type.

See Also

CGAL::Data_access<Map>
CGAL::natural_neighbor_coordinates_2
CGAL::regular_neighbor_coordinates_2
CGAL::surface_neighbor_coordinates_3