CGAL 6.0.2 - 2D and Surface Function Interpolation

Loading...
Searching...
No Matches
Functions
Sibson Gradient Fitting Functions
2D and Surface Function Interpolation Reference » Interpolation Functions

##

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.
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().
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().

## 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

  CoordinateInputIterator | must 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`.
  ValueFunctor | must 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`.
  Traits | must be a model of the concept `GradientFittingTraits`.
  Point | must 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,beyond | is the iterator range of the neighbor coordinates for the query point `p`.
  norm | is the normalization factor.
  p | is the query point
  value_function | is a functor that allows to access values of the interpolated function.
  fn | is the value of the function at `p`.
  traits | is 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

  Dt | must be of type `Delaunay_triangulation_2<Dt_Traits, Tds>`. `Dt_Traits` must be a model of the concepts `DelaunayTriangulationTraits_2` and `PolygonTraits_2`.
  GradientOutputIterator | must be a model of `OutputIterator` with value type `OutputFunctor::result_type`.
  OutputFunctor | must 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.
  ValueFunctor | must 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`.
  Traits | must be a model of `GradientFittingTraits`.

Parameters

  dt | is the Delaunay triangulation.
  out | is an object of type `GradientOutputIterator`.
  fct | is an object of type `OutputFunctor`.
  value_function | is a functor of type `ValueFunctor` that gives access to the values of the function at points of the triangulation.
  traits | is 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_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

  Rt | must be of type `Regular_triangulation_2<Rt_Traits, Tds>`. `Rt_Traits` must be a model of the concepts `RegularTriangulationTraits_2` and `PolygonTraits_2`.
  GradientOutputIterator | must be a model of `OutputIterator` with value type `OutputFunctor::result_type`.
  OutputFunctor | must 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.
  ValueFunctor | must 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`.
  Traits | must be a model of `GradientFittingTraits`.

Parameters

  rt | is the regular triangulation.
  out | is an object of type `GradientOutputIterator`.
  fct | is an object of type `OutputFunctor`.
  value_function | is a functor of type `ValueFunctor` that gives access to the values of the function at points of the triangulation.
  traits | is 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.