CGAL 5.6.3 - 2D Generalized Barycentric Coordinates

Loading...
Searching...
No Matches
List of all members
CGAL::Barycentric_coordinates::Discrete_harmonic_coordinates_2< VertexRange, GeomTraits, PointMap > Class Template Reference
2D Generalized Barycentric Coordinates Reference » Analytic Coordinates

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

## Definition

template<typename VertexRange, typename GeomTraits, typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
class CGAL::Barycentric_coordinates::Discrete_harmonic_coordinates_2< VertexRange, GeomTraits, PointMap >

2D discrete harmonic coordinates.

This class implements 2D discrete harmonic coordinates ( [2], [9], [1] ), which can be computed at any point inside a strictly convex polygon.

Discrete harmonic coordinates are well-defined in the closure of a strictly convex polygon but they are not necessarily positive. The coordinates are computed analytically. See more details in the user manual here.

Template Parameters

  VertexRange | a model of `ConstRange` whose iterator type is `RandomAccessIterator`
  GeomTraits | a model of `BarycentricTraits_2`
  PointMap | a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and value type is `Point_2`. The default is `CGAL::Identity_property_map`.

Examples
  Barycentric_coordinates_2/discrete_harmonic_coordinates.cpp.

## Types
typedef GeomTraits::FT | FT
| Number type.
typedef GeomTraits::Point_2 | Point_2
| Point type.

## Initialization
| Discrete_harmonic_coordinates_2 (const VertexRange &polygon, const Computation_policy_2 policy=Computation_policy_2::PRECISE_WITH_EDGE_CASES, const GeomTraits traits=GeomTraits(), const PointMap point_map=PointMap())
| initializes all internal data structures.

## Access
template<typename OutIterator >
OutIterator | weights (const Point_2 &query, OutIterator w_begin)
| computes 2D discrete harmonic weights.
template<typename OutIterator >
OutIterator | operator() (const Point_2 &query, OutIterator c_begin)
| computes 2D discrete harmonic coordinates.

## Constructor & Destructor Documentation

## ◆ Discrete_harmonic_coordinates_2()

template<typename VertexRange , typename GeomTraits , typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>

CGAL::Barycentric_coordinates::Discrete_harmonic_coordinates_2< VertexRange, GeomTraits, PointMap >::Discrete_harmonic_coordinates_2 | ( | const VertexRange & | polygon,
|  | const Computation_policy_2 | policy = `Computation_policy_2::PRECISE_WITH_EDGE_CASES`,
|  | const GeomTraits | traits = `GeomTraits()`,
|  | const PointMap | point_map = `PointMap()`
| ) |  |

initializes all internal data structures.

This class implements the behavior of discrete harmonic coordinates for 2D query points.

Parameters

  polygon | an instance of `VertexRange` with the vertices of a strictly convex polygon
  policy | one of the `Computation_policy_2`; the default is `Computation_policy_2::PRECISE_WITH_EDGE_CASES`
  traits | a traits class with geometric objects, predicates, and constructions; the default initialization is provided
  point_map | an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; the default initialization is provided

Precondition
  polygon.size() >= 3
  polygon is simple
  polygon is strictly convex

## Member Function Documentation

## ◆ operator()()

template<typename VertexRange , typename GeomTraits , typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
template<typename OutIterator >

OutIterator CGAL::Barycentric_coordinates::Discrete_harmonic_coordinates_2< VertexRange, GeomTraits, PointMap >::operator() | ( | const Point_2 & | query,
|  | OutIterator | c_begin
| ) |  |

computes 2D discrete harmonic coordinates.

This function fills `c_begin` with 2D discrete harmonic coordinates computed at the `query` point with respect to the vertices of the input polygon.

The number of returned coordinates equals to the number of polygon vertices.

After the coordinates \(b_i\) with \(i = 1\dots n\) are computed, where \(n\) is the number of polygon vertices, the query point \(q\) can be obtained as \(q = \sum_{i = 1}^{n}b_ip_i\), where \(p_i\) are the polygon vertices.

Template Parameters

  OutIterator | a model of `OutputIterator` that accepts values of type `FT`

Parameters

  query | a query point
  c_begin | the beginning of the destination range with the computed coordinates

Returns
  an output iterator to the element in the destination range, one past the last coordinate stored

## ◆ weights()

template<typename VertexRange , typename GeomTraits , typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
template<typename OutIterator >

OutIterator CGAL::Barycentric_coordinates::Discrete_harmonic_coordinates_2< VertexRange, GeomTraits, PointMap >::weights | ( | const Point_2 & | query,
|  | OutIterator | w_begin
| ) |  |

computes 2D discrete harmonic weights.

This function fills `weights` with 2D discrete harmonic weights computed at the `query` point with respect to the vertices of the input polygon. If `query` belongs to the polygon boundary, the returned weights are normalized.

The number of returned weights equals to the number of polygon vertices.

Template Parameters

  OutIterator | a model of `OutputIterator` that accepts values of type `FT`

Parameters

  query | a query point
  w_begin | the beginning of the destination range with the computed weights

Returns
  an output iterator to the element in the destination range, one past the last weight stored