\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.4 - 2D and Surface Function Interpolation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Modules

 Sibson gradient fitting functions
 These functions approximate the gradient of a function at a point p given natural neighbor coordinates for p and its neighbors' function values.
 

Classes

class  CGAL::Interpolation_gradient_fitting_traits_2< K >
 Interpolation_gradient_fitting_traits_2 is a model for the concepts InterpolationTraits and GradientFittingTraits. More...
 
class  CGAL::Interpolation_traits_2< K >
 Interpolation_traits_2 is a model for the concept InterpolationTraits and can be used to instantiate the geometric traits class of interpolation methods applied on a bivariate function over a two-dimensional domain. More...
 

Functions

template<class RandomAccessIterator , class Functor , class GradFunctor , class Traits >
Functor::result_type CGAL::farin_c1_interpolation (RandomAccessIterator first, RandomAccessIterator beyond, const typename std::iterator_traits< RandomAccessIterator >::value_type::second_type &norm, const typename std::iterator_traits< ForwardIterator >::value_type::first_type &p, Functor function_value, GradFunctor function_gradient, const Traits &traits)
 generates the interpolated function value computed by Farin's interpolant. More...
 
template<class ForwardIterator , class Functor >
Functor::result_type::first_type CGAL::linear_interpolation (ForwardIterator first, ForwardIterator beyond, const typename std::iterator_traits< ForwardIterator >::value_type::second_type &norm, Functor function_values)
 The function linear_interpolation() computes the weighted sum of the function values which must be provided via a functor. More...
 
template<class ForwardIterator , class Functor , class GradFunctor , class Traits >
Functor::result_type CGAL::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::first_type &p, Functor function_value, GradFunctor function_gradient, const Traits &traits)
 The function quadratic_interpolation() generates the interpolated function value as the weighted sum of the values plus a linear term in the gradient for each point of the point/coordinate pairs in the range [first, beyond). More...
 
template<class ForwardIterator , class Functor , class GradFunctor , class Traits >
std::pair< typename
Functor::result_type, bool > 
CGAL::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::first_type &p, Functor function_value, GradFunctor function_gradient, const Traits &traits)
 The function sibson_c1_interpolation() generates the interpolated function value at the point p, using functors for the function values and the gradients, by applying Sibson's \( Z^1\) interpolant. More...
 
template<class ForwardIterator , class Functor , class GradFunctor , class Traits >
Functor::result_type CGAL::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::first_type &p, Functor function_value, GradFunctor function_gradient, const Traits &traits)
 The same as sibson_c1_interpolation() except that no square root operation is needed for FT.
 

Function Documentation

template<class RandomAccessIterator , class Functor , class GradFunctor , class Traits >
Functor::result_type CGAL::farin_c1_interpolation ( RandomAccessIterator  first,
RandomAccessIterator  beyond,
const typename std::iterator_traits< RandomAccessIterator >::value_type::second_type &  norm,
const typename std::iterator_traits< ForwardIterator >::value_type::first_type &  p,
Functor  function_value,
GradFunctor  function_gradient,
const Traits &  traits 
)

generates the interpolated function value computed by Farin's interpolant.

Precondition
norm \( \neq0\). function_value(p).second == true for all points p of the point/coordinate pairs in the range [first, beyond).
The range [first, beyond) contains either one or more than three elements. The function farin_c1_interpolation() interpolates the function values and the gradients that are provided by functors using the method described in [4].

Parameters

The value type of RandomAccessIterator is a pair associating a point to a (non-normalized) barycentric coordinate. See sibson_c1_interpolation() for the other parameters.

Requirements

Same requirements as for sibson_c1_interpolation() only the iterator must provide random access and Traits::FT does not need to provide the square root operation.

See Also
CGAL::Data_access<Map>
CGAL::linear_interpolation()
CGAL::sibson_c1_interpolation()
Sibson gradient fitting functions
CGAL::Interpolation_traits_2<K>
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions

#include <CGAL/interpolation_functions.h>

template<class ForwardIterator , class Functor >
Functor::result_type::first_type CGAL::linear_interpolation ( ForwardIterator  first,
ForwardIterator  beyond,
const typename std::iterator_traits< ForwardIterator >::value_type::second_type &  norm,
Functor  function_values 
)

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

Template Parameters
ForwardIteratormust have as value type a pair associating a point to a (non-normalized) barycentric coordinate, that is std::iterator_traits<ForwardIterator>::value_type::first_type is equivalent to a point and std::iterator_traits<ForwardIterator>::value_type::second_type is a field number type.
FunctorThe type Functor::argument_type must be equivalent to std::iterator_traits<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 std::iterator_traits<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. std::map) having the point type as key_type and the function value type as mapped_type.

Parameters
first,beyondare the iterator range for the weighted input points.
normis the normalization factor. norm \( \neq0\).
function_valuesis a functor that allows to access a pair of a function value and a Boolean for a given point. 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). function_value(q).second == true for all points q of the point/coordinate pairs in the range [first, beyond).
See Also
CGAL::Data_access<Map>
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions

#include <CGAL/interpolation_functions.h>

Examples:
Interpolation/linear_interpolation_2.cpp.
template<class ForwardIterator , class Functor , class GradFunctor , class Traits >
Functor::result_type CGAL::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::first_type &  p,
Functor  function_value,
GradFunctor  function_gradient,
const Traits &  traits 
)

The function quadratic_interpolation() generates the interpolated function value as the weighted sum of the values plus a linear term in the gradient for each point of the point/coordinate pairs in the range [first, beyond).

Parameters and Template Parameters

The same as for sibson_c1_interpolation() only that Traits::FT does not need to provide the square root operation.

See Also
InterpolationTraits
GradientFittingTraits
CGAL::Data_access<Map>
Sibson gradient fitting functions
CGAL::linear_interpolation()
CGAL::Interpolation_traits_2<K>
CGAL::Interpolation_gradient_fitting_traits_2<K>
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions

#include <CGAL/interpolation_functions.h>

template<class ForwardIterator , class Functor , class GradFunctor , class Traits >
std::pair< typename Functor::result_type,bool> CGAL::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::first_type &  p,
Functor  function_value,
GradFunctor  function_gradient,
const Traits &  traits 
)

The function sibson_c1_interpolation() generates the interpolated function value at the point p, using functors for the function values and the gradients, by applying Sibson's \( Z^1\) interpolant.

If the functor function_gradient cannot supply the gradient of a point, the function returns a pair where the Boolean is set to false. If the interpolation was successful, the pair contains the interpolated function value as first and true as second value.

Template Parameters
Traitsmust be a model of InterpolationTraits. The number type FT provided by Traits must support the square root operation sqrt().
ForwardIteratormust have as value type a pair associating a point to a (non-normalized) barycentric coordinate. More precisely, std::iterator_traits<ForwardIterator>::value_type::first_type is equivalent to Traits::Point_d and std::iterator_traits<ForwardIterator>::value_type::second_type is equivalent to Traits::FT.
Functormust be a functor where Functor::argument_type must be equivalent to Traits::Point_d and Functor::result_type is a pair of the function value type and a Boolean. The function value type must provide a multiplication and addition operation with the type Traits::FT as well as a constructor with argument 0.
GradFunctormust be a functor where GradFunctor::argument_type must be equivalent to Traits::Point_d and Functor::result_type is a pair of the function's gradient type and a Boolean. The function gradient type must provide a multiplication operation with Traits::Vector_d.

A model of the functor types Functor (resp. GradFunctor) is provided by the struct Data_access. It must be instantiated accordingly with an associative container (e.g. std::map) having the point type as key_type and the function value type (resp. function gradient type) as mapped_type.

Parameters
first,beyondis the iterator range of the barycentric coordinates for the query point p.
normis the normalization factor. norm \( \neq0\).
pis the point at which the interpolated function value is generated
function_valueis a functor that allows to access the value of the interpolated function given a point. function_value(q).second == true for all points q of the point/coordinate pairs in the range [first, beyond)
function_gradientis a functor that allows to access the function gradient given a point.
traitsis an instance of the traits class
See Also
InterpolationTraits
GradientFittingTraits
CGAL::Data_access<Map>
Sibson gradient fitting functions
CGAL::linear_interpolation()
CGAL::Interpolation_traits_2<K>
CGAL::Interpolation_gradient_fitting_traits_2<K>
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions

#include <CGAL/interpolation_functions.h>