CGAL 5.1 - 2D and 3D Linear Geometry Kernel
|
#include <CGAL/Weighted_point_2.h>
An object of the class Weighted_point_2
is a tuple of a two-dimensional point and a scalar weight.
Remember that Kernel::RT
and Kernel::FT
denote a RingNumberType
and a FieldNumberType
, respectively. For the kernel model Cartesian<NT>
, the two types are the same. For the kernel model Homogeneous<NT>
, Kernel::RT
is equal to NT
, and Kernel::FT
is equal to Quotient<NT>
.
Hashable
if Kernel
is a cartesian kernel and if Kernel::FT
is Hashable
Types | |
typedef unspecified_type | Cartesian_const_iterator |
An iterator for enumerating the Cartesian coordinates of a point. More... | |
Creation | |
Constructors from coordinates are provided for convenience, except that they are only from Cartesian coordinates, and with no weight, so as to avoid any potential ambiguity between the homogeneous weight and the power weight (it should be easy enough to pass a Point_2 explicitly in those cases). | |
Weighted_point_2 (const Origin &ORIGIN) | |
introduces a weighted point with Cartesian coordinates (0,0) and weight 0 . More... | |
Weighted_point_2 (const Point_2< Kernel > &p) | |
introduces a weighted point from point p and weight 0 . More... | |
Weighted_point_2 (const Point_2< Kernel > &p, Kernel::FT &w) | |
introduces a weighted point from point p and weight w . More... | |
Weighted_point_2 (const Kernel::FT &x, const Kernel::FT &y) | |
introduces a weighted point with coordinates x , y , and weight 0 . More... | |
Bare point and weight accessors | |
Point_2< Kernel > | point () const |
returns the point of the weighted point. More... | |
Kernel::FT | weight () const |
returns the weight of the weighted point. More... | |
Operations | |
| |
bool | operator== (const Weighted_point_2< Kernel > &q) const |
Test for equality. More... | |
bool | operator!= (const Weighted_point_2< Kernel > &q) const |
Test for inequality. More... | |
Coordinate Access | |
There are two sets of coordinate access functions, namely to the homogeneous and to the Cartesian coordinates. They can be used independently from the chosen kernel model. Note that you do not lose information with the homogeneous representation, because the | |
Kernel::RT | hx () const |
returns the homogeneous \( x\) coordinate. More... | |
Kernel::RT | hy () const |
returns the homogeneous \( y\) coordinate. More... | |
Kernel::RT | hw () const |
returns the homogenizing coordinate. More... | |
Kernel::FT | x () const |
returns the Cartesian \( x\) coordinate, that is hx() /hw() . More... | |
Kernel::FT | y () const |
returns the Cartesian \( y\) coordinate, that is hy() /hw() . More... | |
Convenience Operations | |
The following operations are for convenience and for compatibility with higher dimensional points. Again they come in a Cartesian and in a homogeneous flavor. | |
Kernel::RT | homogeneous (int i) const |
returns the i'th homogeneous coordinate of p . More... | |
Kernel::FT | cartesian (int i) const |
returns the i'th Cartesian coordinate of p . More... | |
Kernel::FT | operator[] (int i) const |
returns cartesian(i) . More... | |
Cartesian_const_iterator | cartesian_begin () const |
returns an iterator to the Cartesian coordinates of p , starting with the 0th coordinate. More... | |
Cartesian_const_iterator | cartesian_end () const |
returns an off the end iterator to the Cartesian coordinates of p . More... | |
int | dimension () const |
returns the dimension (the constant 2). More... | |
Bbox_2 | bbox () const |
returns a bounding box containing p . More... | |
Weighted_point_2< Kernel > | transform (const Aff_transformation_2< Kernel > &t) const |
returns the weighted point obtained by applying t on p . More... | |
typedef unspecified_type CGAL::Weighted_point_2< Kernel >::Cartesian_const_iterator |
An iterator for enumerating the Cartesian coordinates of a point.
CGAL::Weighted_point_2< Kernel >::Weighted_point_2 | ( | const Origin & | ORIGIN | ) |
introduces a weighted point with Cartesian coordinates (0,0)
and weight 0
.
|
explicit |
introduces a weighted point from point p
and weight 0
.
explicit
keyword is used to avoid accidental implicit conversions between Point_2 and Weighted_point_2. CGAL::Weighted_point_2< Kernel >::Weighted_point_2 | ( | const Point_2< Kernel > & | p, |
Kernel::FT & | w | ||
) |
introduces a weighted point from point p
and weight w
.
CGAL::Weighted_point_2< Kernel >::Weighted_point_2 | ( | const Kernel::FT & | x, |
const Kernel::FT & | y | ||
) |
introduces a weighted point with coordinates x
, y
, and weight 0
.
Bbox_2 CGAL::Weighted_point_2< Kernel >::bbox | ( | ) | const |
returns a bounding box containing p
.
Kernel::FT CGAL::Weighted_point_2< Kernel >::cartesian | ( | int | i | ) | const |
returns the i'th Cartesian coordinate of p
.
Cartesian_const_iterator CGAL::Weighted_point_2< Kernel >::cartesian_begin | ( | ) | const |
returns an iterator to the Cartesian coordinates of p
, starting with the 0th coordinate.
Cartesian_const_iterator CGAL::Weighted_point_2< Kernel >::cartesian_end | ( | ) | const |
returns an off the end iterator to the Cartesian coordinates of p
.
int CGAL::Weighted_point_2< Kernel >::dimension | ( | ) | const |
returns the dimension (the constant 2).
Kernel::RT CGAL::Weighted_point_2< Kernel >::homogeneous | ( | int | i | ) | const |
returns the i'th homogeneous coordinate of p
.
Kernel::RT CGAL::Weighted_point_2< Kernel >::hw | ( | ) | const |
returns the homogenizing coordinate.
Kernel::RT CGAL::Weighted_point_2< Kernel >::hx | ( | ) | const |
returns the homogeneous \( x\) coordinate.
Kernel::RT CGAL::Weighted_point_2< Kernel >::hy | ( | ) | const |
returns the homogeneous \( y\) coordinate.
bool CGAL::Weighted_point_2< Kernel >::operator!= | ( | const Weighted_point_2< Kernel > & | q | ) | const |
Test for inequality.
The point can be compared with ORIGIN
.
bool CGAL::Weighted_point_2< Kernel >::operator== | ( | const Weighted_point_2< Kernel > & | q | ) | const |
Test for equality.
Two points are equal, iff their \( x\) and \( y\) coordinates are equal. The point can be compared with ORIGIN
.
Kernel::FT CGAL::Weighted_point_2< Kernel >::operator[] | ( | int | i | ) | const |
returns cartesian(i)
.
Point_2<Kernel> CGAL::Weighted_point_2< Kernel >::point | ( | ) | const |
returns the point of the weighted point.
Weighted_point_2<Kernel> CGAL::Weighted_point_2< Kernel >::transform | ( | const Aff_transformation_2< Kernel > & | t | ) | const |
returns the weighted point obtained by applying t
on p
.
Kernel::FT CGAL::Weighted_point_2< Kernel >::weight | ( | ) | const |
returns the weight of the weighted point.
Kernel::FT CGAL::Weighted_point_2< Kernel >::x | ( | ) | const |
Kernel::FT CGAL::Weighted_point_2< Kernel >::y | ( | ) | const |