CGAL 6.2 - 2D Generalized Barycentric Coordinates

Loading...
Searching...
No Matches
List of all members
CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits > Class Template Reference
Reference Manual » Deprecated

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

## Definition

template<class Coordinate_2, class Traits>
class CGAL::Barycentric_coordinates::Generalized_barycentric_coordinates_2< Coordinate_2, Traits >

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`.

Deprecated:
  This part of the package is deprecated since the version 5.4 of CGAL.

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/deprecated_coordinates.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.

## 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)`.

## Computation
template<class OutputIterator >
std::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.
template<class OutputIterator >
std::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.
template<class OutputIterator >
std::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.
template<class OutputIterator >
std::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.

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

## ◆ Vertex_range

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

## ◆ Generalized_barycentric_coordinates_2()

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

## ◆ compute_on_edge()

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

std::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).

## ◆ compute_on_vertex()

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

std::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).

## ◆ compute_weights()

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

std::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.

## ◆ operator()()

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

std::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.