CGAL 5.5.2 - 2D and Surface Function Interpolation

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

Further functions are provided to fit the gradient for all data points that lie inside the convex hull of the data points. One function exists for each type of neighbor coordinates (natural and regular).

Output Format

The output format of the functions CGAL::sibson_gradient_fitting_nn_2() and CGAL::sibson_gradient_fitting_rn_2() can be customized using the functor parameter of type OutputFunctor: this functor must have argument type std::pair<Tr::Vertex_handle, Traits::Vector_d> (where Tr and Traits are the types of the triangulation and traits passed in arguments) but its result type is set as desired by the user.

See also natural neighbor coordinates functions, which use the same mechanism to allow flexible output.

See also
CGAL::Interpolation_gradient_fitting_traits_2<K>
CGAL::natural_neighbor_coordinates_2()
CGAL::regular_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions
Interpolation Functions

Functions

template<class CoordinateInputIterator , class ValueFunctor , class Traits , class Point >
Traits::Vector_d CGAL::sibson_gradient_fitting (CoordinateInputIterator first, CoordinateInputIterator beyond, const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &norm, const Point &p, ValueFunctor value_function, const typename ValueFunctor::result_type::first_type fn, const Traits &traits)
 Estimates the gradient of a function at a query point. More...
 
template<class Dt , class GradientOutputIterator , class OutputFunctor , class ValueFunctor , class Traits >
GradientOutputIterator CGAL::sibson_gradient_fitting_nn_2 (const Dt &dt, GradientOutputIterator out, OutputFunctor fct, ValueFunctor value_function, const Traits &traits)
 Estimates the function gradients at all vertices of the Delaunay triangulation dt that lie inside the convex hull, using the coordinates computed by the function CGAL::natural_neighbor_coordinates_2(). More...
 
template<class Rt , class GradientOutputIterator , class OutputFunctor , class ValueFunctor , class Traits >
GradientOutputIterator CGAL::sibson_gradient_fitting_rn_2 (const Rt &rt, GradientOutputIterator out, OutputFunctor fct, ValueFunctor value_function, const Traits &traits)
 Estimates the function gradients at all vertices of rt that lie inside the convex hull using the coordinates computed by the functions CGAL::regular_neighbor_coordinates_2(). More...
 

Function Documentation

◆ sibson_gradient_fitting()

template<class CoordinateInputIterator , class ValueFunctor , class Traits , class Point >
Traits::Vector_d CGAL::sibson_gradient_fitting ( CoordinateInputIterator  first,
CoordinateInputIterator  beyond,
const typename std::iterator_traits< CoordinateInputIterator >::value_type::second_type &  norm,
const Point &  p,
ValueFunctor  value_function,
const typename ValueFunctor::result_type::first_type  fn,
const Traits &  traits 
)

#include <CGAL/sibson_gradient_fitting.h>

Estimates the gradient of a function at a query point.

Template Parameters
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.
Traitsmust be a model of the concept GradientFittingTraits.
Pointmust be equivalent to Traits::Point_d or Traits::Weighted_point_d.

An example of compatible types for CoordinateInputIterator and ValueFunctor is a forward iterator with value type std::pair<Vertex_handle, Traits::FT> and a functor with argument type Vertex_handle.

Parameters
first,beyondis the iterator range of the neighbor coordinates for the query point p.
normis the normalization factor.
pis the query point
value_functionis a functor that allows to access values of the interpolated function.
fnis the value of the function at p.
traitsis an instance of the gradient fitting traits class.
Returns
the gradient at the point p.

◆ sibson_gradient_fitting_nn_2()

template<class Dt , class GradientOutputIterator , class OutputFunctor , class ValueFunctor , class Traits >
GradientOutputIterator CGAL::sibson_gradient_fitting_nn_2 ( const Dt &  dt,
GradientOutputIterator  out,
OutputFunctor  fct,
ValueFunctor  value_function,
const Traits &  traits 
)

#include <CGAL/sibson_gradient_fitting.h>

Estimates the function gradients at all vertices of the Delaunay triangulation dt that lie inside the convex hull, using the coordinates computed by the function CGAL::natural_neighbor_coordinates_2().

Template Parameters
Dtmust be of type Delaunay_triangulation_2<Dt_Traits, Tds>. Dt_Traits must be a model of the concepts DelaunayTriangulationTraits_2 and PolygonTraits_2.
GradientOutputIteratormust be a model of OutputIterator with value type OutputFunctor::result_type.
OutputFunctormust be a functor with argument type std::pair<Dt::Vertex_handle, Traits::Vector_d>. Note that the result type of the functor is not specified and is chosen by users to fit their needs.
ValueFunctormust be a functor where:
  • ValueFunctor::argument_type must be either Dt::Vertex_handle or Dt::Point.
  • 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.
Traitsmust be a model of GradientFittingTraits.
Parameters
dtis the Delaunay triangulation.
outis an object of type GradientOutputIterator.
fctis an object of type OutputFunctor.
value_functionis a functor of type ValueFunctor that gives access to the values of the function at points of the triangulation.
traitsis an instance of the gradient fitting traits class.
Returns
An output iterator with value type OutputFunctor::result_type. The sequence is written starting at out. The function returns an iterator that is placed past-the-end of the resulting sequence.
Examples:
Interpolation/sibson_interpolation_2.cpp, and Interpolation/sibson_interpolation_vertex_with_info_2.cpp.

◆ sibson_gradient_fitting_rn_2()

template<class Rt , class GradientOutputIterator , class OutputFunctor , class ValueFunctor , class Traits >
GradientOutputIterator CGAL::sibson_gradient_fitting_rn_2 ( const Rt &  rt,
GradientOutputIterator  out,
OutputFunctor  fct,
ValueFunctor  value_function,
const Traits &  traits 
)

#include <CGAL/sibson_gradient_fitting.h>

Estimates the function gradients at all vertices of rt that lie inside the convex hull using the coordinates computed by the functions CGAL::regular_neighbor_coordinates_2().

Template Parameters
Rtmust be of type Regular_triangulation_2<Rt_Traits, Tds>. Rt_Traits must be a model of the concepts RegularTriangulationTraits_2 and PolygonTraits_2.
GradientOutputIteratormust be a model of OutputIterator with value type OutputFunctor::result_type.
OutputFunctormust be a functor with argument type std::pair<Rt::Vertex_handle, Traits::Vector_d>. Note that the result type of the functor is not specified and is chosen by users to fit their needs.
ValueFunctormust be a functor where:
  • ValueFunctor::argument_type must be either Rt::Vertex_handle or Rt::Weighted_point.
  • 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.
Traitsmust be a model of GradientFittingTraits.
Parameters
rtis the regular triangulation.
outis an object of type GradientOutputIterator.
fctis an object of type OutputFunctor.
value_functionis a functor of type ValueFunctor that gives access to the values of the function at points of the triangulation.
traitsis an instance of the gradient fitting traits class.
Returns
An output iterator with value type OutputFunctor::result_type. The sequence is written starting at out. The function returns an iterator that is placed past-the-end of the resulting sequence.