CGAL 6.0 - 2D Generalized Barycentric Coordinates
|
#include <CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h>
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
.
Coordinate_2 | must be a model of the concept BarycentricCoordinates_2 . |
Traits | must be a model of the concepts BarycentricTraits_2 and PolygonTraits_2 . |
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. | |
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
.
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
.
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.
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.
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
.
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.