CGAL 5.1 - 2D and Surface Function Interpolation

Modules

 Sibson Gradient Fitting Functions
 The first function implements Sibson's gradient estimation method based on natural neighbor coordinates [9].
 

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 CoordinateInputIterator , class ValueFunctor >
ValueFunctor::result_type::first_type CGAL::linear_interpolation (CoordinateInputIterator first, CoordinateInputIterator beyond, const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &norm, ValueFunctor value_function)
 The function linear_interpolation() computes the weighted sum of the function values which must be provided via a functor. More...
 
template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
ValueFunctor::result_type CGAL::quadratic_interpolation (CoordinateInputIterator first, CoordinateInputIterator beyond, const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &norm, const Point &p, ValueFunctor value_function, GradFunctor gradient_function, 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 entity of the entity/coordinate pairs in the range [first, beyond). More...
 
template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
std::pair< typename ValueFunctor::result_type, bool > CGAL::sibson_c1_interpolation (CoordinateInputIterator first, CoordinateInputIterator beyond, const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &norm, const Point &p, ValueFunctor value_function, GradFunctor gradient_function, 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 CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
ValueFunctor::result_type CGAL::sibson_c1_interpolation_square (CoordinateInputIterator first, CoordinateInputIterator beyond, const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &norm, const Point &p, ValueFunctor value_function, GradFunctor gradient_function, const Traits &traits)
 Same as sibson_c1_interpolation(), except that no square root operation is required for the number type Traits::FT. More...
 
template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
ValueFunctor::result_type CGAL::farin_c1_interpolation (CoordinateInputIterator first, CoordinateInputIterator beyond, const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &norm, const Point &p, ValueFunctor value_function, GradFunctor gradient_function, const Traits &traits)
 Generates the interpolated function value computed by Farin's interpolant. More...
 

Function Documentation

◆ farin_c1_interpolation()

template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
ValueFunctor::result_type CGAL::farin_c1_interpolation ( CoordinateInputIterator  first,
CoordinateInputIterator  beyond,
const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &  norm,
const Point &  p,
ValueFunctor  value_function,
GradFunctor  gradient_function,
const Traits &  traits 
)

#include <CGAL/interpolation_functions.h>

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

Requirements

Same requirements as the function sibson_c1_interpolation(), but the input iterator must provide random access (be a model of RandomAccessIterator) and Traits::FT does not need to provide the square root operation.

Precondition
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].
See also
CGAL::sibson_c1_interpolation()
Examples:
Interpolation/interpolation_2.cpp.

◆ linear_interpolation()

template<class CoordinateInputIterator , class ValueFunctor >
ValueFunctor::result_type::first_type CGAL::linear_interpolation ( CoordinateInputIterator  first,
CoordinateInputIterator  beyond,
const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &  norm,
ValueFunctor  value_function 
)

#include <CGAL/interpolation_functions.h>

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

Template Parameters
CoordinateInputIteratormust be a model of ForwardIterator and must have as value type a pair associating an entity, e.g. the Vertex_handle or Point types of a triangulation, to a (non-normalized) barycentric coordinate.
ValueFunctormust be a functor where ValueFunctor::argument_type must be equivalent to std::iterator_traits<CoordinateInputIterator>::value_type::first_type and ValueFunctor::result_type is a pair of the function value type and a Boolean. The function value type VT must provide an addition operator, and a multiplication operator with the type Traits::FT.

A model of the functor ValueFunctor is provided by the struct CGAL::Data_access instantiated with an associative container (e.g. std::map) and having:

  • std::iterator_traits<CoordinateInputIterator>::value_type::first_type (the entity type) as key_type
  • std::iterator_traits<CoordinateInputIterator>::value_type::second_type (the coordinate type) as mapped_type.

The two template parameters must satisfy the following conditions:

  • std::iterator_traits<CoordinateInputIterator>::value_type::first_type (the entity type) is equivalent to a ValueFunctor::argument_type.
  • std::iterator_traits<CoordinateInputIterator>::value_type::second_type (the coordinate type) is a field number type that is equivalent to ValueFunctor::result_type::first_type.

For example, if CoordinateInputIterator is an iterator with value type std::pair<Vertex_handle, double>, then the ValueFunctor must have argument type Vertex_handle (or convertible to) and return type std::pair<double, bool>.

Parameters
first,beyondis the iterator range for the coordinates.
normis the normalization factor.
value_functionis a functor of type ValueFunctor that allows to access a pair of a function value and a Boolean at a given entity. 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 entry of the entity/coordinate pairs in the range [first, beyond).
Precondition
norm \( \neq0\).
first != beyond.
value_function(p.first).second == true for all pairs p in the range [first, beyond).
See also
CGAL::quadratic_interpolation()
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions
Examples:
Interpolation/interpolation_2.cpp, Interpolation/linear_interpolation_2.cpp, and Interpolation/linear_interpolation_of_vector_3.cpp.

◆ quadratic_interpolation()

template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
ValueFunctor::result_type CGAL::quadratic_interpolation ( CoordinateInputIterator  first,
CoordinateInputIterator  beyond,
const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &  norm,
const Point &  p,
ValueFunctor  value_function,
GradFunctor  gradient_function,
const Traits &  traits 
)

#include <CGAL/interpolation_functions.h>

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 entity of the entity/coordinate pairs in the range [first, beyond).

Returns
If the interpolation was successful, the pair contains the interpolated function value as first and true as second value. Otherwise, the second value will be false.
Template Parameters
Traitsmust be a model of InterpolationTraits. Note that, contrary to some other interpolation methods, the number type FT provided by Traits does not need to provide the square root operation.
CoordinateInputIteratormust be a model of ForwardIterator and must have as value type a pair associating an entity to a (non-normalized) barycentric coordinate. More precisely, std::iterator_traits<CoordinateInputIterator>::value_type::first_type can be of the following types:
  • a type equivalent to Traits::Point_d or Traits::Weighted_point_d
  • an iterator type providing a point() function returning a type equivalent to Traits::Point_d or Traits::Weighted_point_d;
and std::iterator_traits<CoordinateInputIterator>::value_type::second_type must be equivalent to Traits::FT.
ValueFunctormust be a functor where ValueFunctor::argument_type must be equivalent to std::iterator_traits<CoordinateInputIterator>::value_type::first_type and ValueFunctor::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 std::iterator_traits<CoordinateInputIterator>::value_type::first_type 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.
Pointmust be equivalent to Traits::Point_d or Traits::Weighted_point_d.

A model of the functor types ValueFunctor (resp. GradFunctor) is provided by the struct CGAL::Data_access. It must be instantiated accordingly with an associative container (e.g. std::map) having std::iterator_traits<CoordinateInputIterator>::value_type::first_type as key_type and the function value type (resp. the 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.
pis the point at which the interpolated function value is computed.
value_functionis a functor that allows to access values of the interpolated function.
gradient_functionis a functor that allows to access the function gradients. If the functor gradient_function cannot supply the gradient of a point, the function returns a pair where the Boolean is set to false.
traitsis an instance of the traits class.
Precondition
norm \( \neq0\).
first != beyond.
value_function(p.first).second == true for pairs p in the range [first, beyond)
See also
CGAL::linear_interpolation()
CGAL::Interpolation_traits_2<K>
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions
Examples:
Interpolation/interpolation_2.cpp.

◆ sibson_c1_interpolation()

template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
std::pair<typename ValueFunctor::result_type, bool> CGAL::sibson_c1_interpolation ( CoordinateInputIterator  first,
CoordinateInputIterator  beyond,
const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &  norm,
const Point &  p,
ValueFunctor  value_function,
GradFunctor  gradient_function,
const Traits &  traits 
)

#include <CGAL/interpolation_functions.h>

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.

Returns
If the interpolation was successful, the pair contains the interpolated function value as first and true as second value. Otherwise, false is returned 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().
CoordinateInputIteratormust be a model of ForwardIterator and must have as value type a pair associating an entity to a (non-normalized) barycentric coordinate. More precisely, std::iterator_traits<CoordinateInputIterator>::value_type::first_type can be of the following types:
  • a type equivalent to Traits::Point_d or Traits::Weighted_point_d
  • an iterator type providing a point() function returning a type equivalent to Traits::Point_d or Traits::Weighted_point_d;
and std::iterator_traits<CoordinateInputIterator>::value_type::second_type must be equivalent to Traits::FT.
ValueFunctormust be a functor where ValueFunctor::argument_type must be equivalent to std::iterator_traits<CoordinateInputIterator>::value_type::first_type and ValueFunctor::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 std::iterator_traits<CoordinatetCoordinateInputIteratorIterator>::value_type::first_type 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.
Pointmust be equivalent to Traits::Point_d or Traits::Weighted_point_d.

A model of the functor types ValueFunctor (resp. GradFunctor) is provided by the struct CGAL::Data_access. It must be instantiated accordingly with an associative container (e.g. std::map) having std::iterator_traits<CoordinateInputIterator>::value_type::first_type as key_type and the function value type (resp. the 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.
pis the point at which the interpolated function value is computed.
value_functionis a functor that allows to access values of the interpolated function.
gradient_functionis a functor that allows to access the function gradients. If the functor gradient_function cannot supply the gradient of a point, the function returns a pair where the Boolean is set to false.
traitsis an instance of the traits class.
Precondition
norm \( \neq0\).
first != beyond.
value_function(q).second == true for all points q of the point/coordinate pairs in the range [first, beyond)
See also
CGAL::Interpolation_traits_2<K>
CGAL::sibson_c1_interpolation_square()
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions
Examples:
Interpolation/interpolation_2.cpp.

◆ sibson_c1_interpolation_square()

template<class CoordinateInputIterator , class ValueFunctor , class GradFunctor , class Traits , class Point >
ValueFunctor::result_type CGAL::sibson_c1_interpolation_square ( CoordinateInputIterator  first,
CoordinateInputIterator  beyond,
const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &  norm,
const Point &  p,
ValueFunctor  value_function,
GradFunctor  gradient_function,
const Traits &  traits 
)

#include <CGAL/interpolation_functions.h>

Same as sibson_c1_interpolation(), except that no square root operation is required for the number type Traits::FT.

See also
CGAL::sibson_c1_interpolation()
Examples:
Interpolation/interpolation_2.cpp, Interpolation/sibson_interpolation_2.cpp, and Interpolation/sibson_interpolation_vertex_with_info_2.cpp.