CGAL 4.7 - 2D Generalized Barycentric Coordinates: CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits > Class Template Reference

\( \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.7 - 2D Generalized Barycentric Coordinates

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits > Class Template Reference
2D Generalized Barycentric Coordinates Reference

`#include <CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h>`

## Definition

The class `Generalized_barycentric_coordinates_2` implements generalized barycentric coordinates along the polygon's boundary and provides a common interface for all coordinate classes.

This class is parameterized by a coordinate class `Coordinate_2`, and a traits class `Traits`.

Template Parameters

  Coordinate_2 | must be a model of the concept `BarycentricCoordinates_2`.
  Traits | must be a model of the concepts `BarycentricTraits_2` and `PolygonTraits_2`.

Examples:
  Barycentric_coordinates_2/Discrete_harmonic_coordinates_example.cpp, Barycentric_coordinates_2/Mean_value_coordinates_example.cpp, Barycentric_coordinates_2/Terrain_height_modeling.cpp, and Barycentric_coordinates_2/Wachspress_coordinates_example.cpp.

## Types

typedef Traits::FT | FT
| Number type.
typedef Traits::Point_2 | Point_2
| Point type.
typedef unspecified_type | Vertex_range
| Range of vertices in a polygon. More...

## Creation

template<class InputIterator >
| Generalized_barycentric_coordinates_2 (const InputIterator &first_vertex, const InputIterator &last_vertex, const Traits &b_traits=Traits())
| Creates the class `Generalized_barycentric_coordinates_2` that implements generalized barycentric coordinates along the polygon's boundary given by a range of vertices `[first_vertex, last_vertex)`. More...

## Computation

template<class OutputIterator >
boost::optional< OutputIterator > | operator() (const Point_2 &query_point, OutputIterator output, Query_point_location query_point_location=UNSPECIFIED_LOCATION, Type_of_algorithm type_of_algorithm=PRECISE)
| Computes generalized barycentric coordinates for any query point in the plane with respect to all the vertices of the polygon. More...
template<class OutputIterator >
boost::optional< OutputIterator > | compute_on_edge (const Point_2 &query_point, const int index, OutputIterator output) const
| Computes generalized barycentric coordinates for a query point on the polygon's boundary with known index of the edge to which this point belongs. More...
template<class OutputIterator >
boost::optional< OutputIterator > | compute_on_vertex (const int index, OutputIterator output) const
| Computes generalized barycentric coordinates for a query point, which coincides with one of the polygon's vertices, with known index. More...
template<class OutputIterator >
boost::optional< OutputIterator > | compute_weights (const Point_2 &query_point, OutputIterator output)
| Computes generalized barycentric weights (unnormalized coordinates) for any strictly interior query point with respect to all the vertices of the polygon. More...

## Endpoint Accessors

const Vertex_range & | vertices () const
| Returns all the vertices of the polygon.
const Point_2 & | first_vertex () const
| Returns the first vertex of the polygon.
const Point_2 & | last_vertex () const
| Returns the last vertex of the polygon.

## Member Typedef Documentation

template<class Coordinate_2 , class Traits >

typedef unspecified_type CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >::Vertex_range

Range of vertices in a polygon.

This type is a model of the concept `Range`. Its iterator type is `RandomAccessIterator`, and its value type is `Traits::Point_2`.

## Constructor & Destructor Documentation

template<class Coordinate_2 , class Traits >
template<class InputIterator >

CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >::Generalized_barycentric_coordinates_2 | ( | const InputIterator & | first_vertex,
|  | const InputIterator & | last_vertex,
|  | const Traits & | b_traits = `Traits()`
| ) |  |

Creates the class `Generalized_barycentric_coordinates_2` that implements generalized barycentric coordinates along the polygon's boundary given by a range of vertices `[first_vertex, last_vertex)`.

`InputIterator` must be an input iterator with a value type equivalent to `Traits::Point_2`.

Precondition
  Number of the polygon's vertices > 2.
  The provided polygon is simple.

## Member Function Documentation

template<class Coordinate_2 , class Traits >
template<class OutputIterator >

boost::optional<OutputIterator> CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >::compute_on_edge | ( | const Point_2 & | query_point,
|  | const int | index,
|  | OutputIterator | output
| ) |  | const

Computes generalized barycentric coordinates for a query point on the polygon's boundary with known index of the edge to which this point belongs.

Computed coordinates are stored in the output iterator `output`, and it is a set of zeros with two possibly non zero values.

Precondition
  The provided query point belongs to the polygon's boundary.
  (0 <= index) && (index < number of the polygon's vertices).

template<class Coordinate_2 , class Traits >
template<class OutputIterator >

boost::optional<OutputIterator> CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >::compute_on_vertex | ( | const int | index,
|  | OutputIterator | output
| ) |  | const

Computes generalized barycentric coordinates for a query point, which coincides with one of the polygon's vertices, with known index.

Computed coordinates are stored in the output iterator `output`, and it is a set of zeros with value of one at the vertex of interest.

Precondition
  (0 <= index) && (index < number of the polygon's vertices).

template<class Coordinate_2 , class Traits >
template<class OutputIterator >

boost::optional<OutputIterator> CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >::compute_weights | ( | const Point_2 & | query_point,
|  | OutputIterator | output
| ) |  |

Computes generalized barycentric weights (unnormalized coordinates) for any strictly interior query point with respect to all the vertices of the polygon.

Computed weights are stored in the output iterator `output`.

Precondition
  The provided query point belongs to the polygon's interior, excluding the boundary.

template<class Coordinate_2 , class Traits >
template<class OutputIterator >

boost::optional<OutputIterator> CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >::operator() | ( | const Point_2 & | query_point,
|  | OutputIterator | output,
|  | Query_point_location | query_point_location = `UNSPECIFIED_LOCATION`,
|  | Type_of_algorithm | type_of_algorithm = `PRECISE`
| ) |  |

Computes generalized barycentric coordinates for any query point in the plane with respect to all the vertices of the polygon.

Computed coordinates are stored in the output iterator `output`.

Different choices of the parameter `query_point_location` are possible: `CGAL::Barycentric_coordinates::UNSPECIFIED_LOCATION` - default constant with automatic check for a location, `CGAL::Barycentric_coordinates::ON_BOUNDED_SIDE` - for a strictly interior query point, `CGAL::Barycentric_coordinates::ON_BOUNDARY` - for a query point on the boundary of the polygon, `CGAL::Barycentric_coordinates::ON_VERTEX` - for a query point at one of the polygon's vertices, and `CGAL::Barycentric_coordinates::ON_UNBOUNDED_SIDE` - for a strictly exterior query point.

Another parameter is `type_of_algorithm` with the following possible constants: `CGAL::Barycentric_coordinates::PRECISE` - default slow algorithm, which is as precise as possible and `CGAL::Barycentric_coordinates::FAST` - fast algorithm, which is less precise but much faster.