CGAL 5.3 - 2D and Surface Function Interpolation
CGAL::regular_neighbor_coordinates_2()

The functions regular_neighbor_coordinates_2() compute natural neighbor coordinates, also called Sibson's coordinates, for weighted 2D points provided a two-dimensional regular triangulation and a (weighted) query point inside the convex hull of the vertices of the triangulation.

We call these coordinates regular neighbor coordinates.

Implementation

This function computes the areas stolen from the power cells of points in the regular triangulation rt by the insertion of the query point p. The total area of the power cell of p is also computed and returned by the function.

Attention
If p lies outside the convex hull, the coordinate values cannot be computed and the third value of the result triple is set to false.

Output Format

The return type is identical for all overloads of CGAL::regular_neighbor_coordinates_2(): it is CGAL::Triple<CoordinateOutputIterator, Rt::Geom_traits::FT, bool >

Regular neighbor coordinates are output in the first value of the triple, using an output iterator (see the concept OutputIterator). Internally, these coordinates are associated to some of the vertices of the triangulation, and a natural value type for the output iterator would thus be std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT>. However, to allow flexibility in the format of the output, a functor passed as argument can be used to format the output as desired: this functor must have argument type std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT> and its result type and the value type of the output iterator must be identical.

For example, we can use a functor of type CGAL::Identity<std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT> > and an output iterator with value type std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT> or we could extract the bare point and use a value type: std::pair<Rt::Weighted_point, Rt::Geom_traits::FT>, or simply the coordinates, etc.

This functor can be omitted and will default, for backward compatibility reasons, to a functor that extracts the point from the vertex, and the output iterator must then have value type std::pair<Rt::Weighted_point, Rt::Geom_traits::FT>.

See also
CGAL::natural_neighbor_coordinates_2()
3D Surface Neighbor Coordinates Functions
Interpolation Functions

## Functions

template<class Rt , class CoordinateOutputIterator , class OutputFunctor >
CGAL::Triple< CoordinateOutputIterator, typename Rt::Geom_traits::FT, bool > CGAL::regular_neighbor_coordinates_2 (const Rt &rt, const typename Rt::Weighted_point &p, CoordinateOutputIterator out, OutputFunctor fct, typename Rt::Face_handle start=typename Rt::Face_handle())
Computes the regular neighbor coordinates for p with respect to the weighted points in the two-dimensional regular triangulation rt. More...

template<class Rt , class CoordinateOutputIterator , class OutputFunctor , class EdgeIterator , class VertexIterator >
CGAL::Triple< CoordinateOutputIterator, typename Traits::FT, bool > CGAL::regular_neighbor_coordinates_2 (const Rt &rt, const typename Traits::Weighted_point &p, CoordinateOutputIterator out, OutputFunctor fct, EdgeIterator hole_begin, EdgeIterator hole_end, VertexIterator hidden_vertices_begin, VertexIterator hidden_vertices_end)
Computes the regular neighbor coordinates for p with respect to the weighted points in the two-dimensional regular triangulation rt. More...

template<class Rt , class CoordinateOutputIterator , class OutputFunctor >
CGAL::Triple< CoordinateOutputIterator, typename Rt::Geom_traits::FT, bool > CGAL::regular_neighbor_coordinates_2 (const Rt &rt, typename Rt::Vertex_handle vh, CoordinateOutputIterator out, OutputFunctor fct)
Computes the regular neighbor coordinates of the point vh->point() with respect to the vertices of rt excluding vh->point(). More...

## ◆ regular_neighbor_coordinates_2() [1/3]

template<class Rt , class CoordinateOutputIterator , class OutputFunctor >
 CGAL::Triple CGAL::regular_neighbor_coordinates_2 ( const Rt & rt, const typename Rt::Weighted_point & p, CoordinateOutputIterator out, OutputFunctor fct, typename Rt::Face_handle start = typename Rt::Face_handle() )

#include <CGAL/regular_neighbor_coordinates_2.h>

Computes the regular neighbor coordinates for p with respect to the weighted points in the two-dimensional regular triangulation rt.

Template Parameters
 Rt must be a Regular_triangulation_2. Traits must be a model of the concepts RegularTriangulationTraits_2 and PolygonTraits_2. CoordinateOutputIterator must be a model of OutputIterator and have the value type OutputFunctor::result_type. The output computed by the function is placed starting at out. OutputFunctor must be a functor with argument type std::pair.

See above for a detailed explanation on the usage of OutputFunctor.

Parameters
 rt is the regular triangulation. p is the query point. out is an object of type CoordinateOutputIterator. fct is an object of type OutputFunctor. start is an optional argument that is used as a hint of where the locate process has to start its search.
Returns
A triple consisting of:
• a sequence of objects of types OutputFunctor::result_type, starting at out.
• the normalization factor of the coordinates.
• a Boolean value which is set to true if the coordinate computation was successful, and false otherwise.
Warning
If the weight of p is so small that the point p would not have any power cell if it were inserted in the power diagram, then the resulting triple will be (out, 0, true) with no additional entry in out (compared to its state in input).
Examples:
Interpolation/rn_coordinates_2.cpp.

## ◆ regular_neighbor_coordinates_2() [2/3]

template<class Rt , class CoordinateOutputIterator , class OutputFunctor , class EdgeIterator , class VertexIterator >
 CGAL::Triple< CoordinateOutputIterator, typename Traits::FT, bool > CGAL::regular_neighbor_coordinates_2 ( const Rt & rt, const typename Traits::Weighted_point & p, CoordinateOutputIterator out, OutputFunctor fct, EdgeIterator hole_begin, EdgeIterator hole_end, VertexIterator hidden_vertices_begin, VertexIterator hidden_vertices_end )

#include <CGAL/regular_neighbor_coordinates_2.h>

Computes the regular neighbor coordinates for p with respect to the weighted points in the two-dimensional regular triangulation rt.

The iterator range [hole_begin, hole_end) determines the boundary edges of the conflict zone of p in the triangulation rt. rt.hidden_vertices_begin() and rt.hidden_vertices_end() determines the iterator range over the hidden vertices of the conflict zone of p inrt. Those ranges can, for example, be computed using the function rt.get_boundary_of_conflicts_and_hidden_vertices(p,std::back_inserter(hole), std::back_inserter(hidden_vertices), start).

Requirements
Same as above.

## ◆ regular_neighbor_coordinates_2() [3/3]

template<class Rt , class CoordinateOutputIterator , class OutputFunctor >
 CGAL::Triple< CoordinateOutputIterator, typename Rt::Geom_traits::FT, bool > CGAL::regular_neighbor_coordinates_2 ( const Rt & rt, typename Rt::Vertex_handle vh, CoordinateOutputIterator out, OutputFunctor fct )

#include <CGAL/regular_neighbor_coordinates_2.h>

Computes the regular neighbor coordinates of the point vh->point() with respect to the vertices of rt excluding vh->point().

Requirements
Same as above.