Remember that R::RT and R::FT denote a ring type and a field type. For the representation class CGAL_Cartesian<T> the two types are the same. For the representation class CGAL_Homogeneous<T> the ring type R::RT is equal to T, and the field type R::FT is equal to CGAL_Quotient<T>.
#include <CGAL/Point_2.h>
| |
introduces a variable p with Cartesian coordinates
.
| |
| |
introduces a point p initialized to
. If the third argument is not explicitly
given, it defaults to R::RT(1).
Precondition: hw is not R::RT(0)
|
|
| Test for equality. Two points are equal, iff their and coordinates are equal. The point can be compared with CGAL_ORIGIN. |
|
| Test for inequality. The point can be compared with CGAL_ORIGIN. |
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 representation type R.
|
| returns the homogeneous coordinate. |
|
| returns the homogeneous coordinate. |
|
| returns the homogenizing coordinate. |
Here come the Cartesian access functions. Note that you do not loose information with the homogeneous representation, because then the field type is a quotient.
|
| returns the Cartesian coordinate, that is . |
|
| returns the Cartesian coordinate, that is . |
The following operations are for convenience and for making this point class compatible with code for higher dimensional points. Again they come in a Cartesian and homogeneous flavor.
|
| |
returns the i'th homogeneous coordinate of p, starting with
0. Precondition: . | ||
|
| |
returns the i'th Cartesian coordinate of p, starting with 0.
Precondition: . | ||
|
|
returns cartesian(i).
Precondition: . |
|
| returns the dimension (the constant 2). |
|
| returns a bounding box containing p. Note that bounding boxes are not parameterized with whatsoever. |
|
| |
returns the point obtained by applying on p. |
|
| returns the difference vector between q and p. You can substitute CGAL_ORIGIN for either p or q ,but not for both. |
|
| |
returns the point obtained by translating p by the vector v. | ||
|
| |
returns the point obtained by translating p by the vector - v. |
CGAL_Point_2< CGAL_Cartesian<double> > p, q(1.0, 2.0);
The variable p is uninitialized and should first be used on the left hand side of an assignment.
p = q; cout << p.x() << " " << p.y() << endl;