Navigation: Up, Table of Contents, Bibliography, Index, Title Page

3D Point (CGAL_Point_3)

Definition

An object of the class CGAL_Point_3 is a point in the three-dimensional Euclidean space E3.

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 equivalent. However, for the representation class CGAL_Homogeneous<T> the ring type is R::RT is equal to T and the field type is R::FT is equal to CGAL_Quotient<T>.

#include <CGAL/Point_3.h>

Creation

CGAL_Point_3<R> p ( CGAL_Origin CGAL_ORIGIN);
introduces a point with Cartesian coordinates(0,0,0).

CGAL_Point_3<R> p ( R::RT hx, R::RT hy, R::RT hz, R::RT hw = R::RT(1));
introduces a point p initialized to (hx/hw,hy/hw, hz/hw). If the third argument is not explicitly given it defaults to R::RT(1).

Operations

bool p == q Test for equality: Two points are equal, iff their x, y and z coordinates are equal.
bool p != q Test for inequality.

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.

R::RT p.hx () returns the homogeneous x coordinate.
R::RT p.hy () returns the homogeneous y coordinate.
R::RT p.hz () returns the homogeneous z coordinate.
R::RT p.hw () 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.

R::FT p.x () returns the Cartesian x coordinate, that is hx/hw.
R::FT p.y () returns the Cartesian y coordinate, that is hy/hw.
R::FT p.z () returns the Cartesian z coordinate, that is hz/hw.

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.

R::RT p.homogeneous ( int i)
returns the i'th homogeneous coordinate of p, starting with 0.
Precondition: 0<=i <=3.
R::FT p.cartesian ( int i)
returns the i'th Cartesian coordinate of p, starting with 0.
Precondition: 0<=i <=2.
R::FT p [ int i] returns cartesian(i).
Precondition: 0<=i <=2.
int p.dimension () returns the dimension (the constant 3).
CGAL_Bbox_3 p.bbox () returns a bounding box containing p.
CGAL_Point_3<R> p.transform ( CGAL_Aff_transformation_3<R> t)
returns the point obtained by applying t on p.

The following operations can be applied on points:

CGAL_Vector_3<R> p - q returns the difference vector between q and p. You can substitute CGAL_ORIGIN for either p or q, but not both.
CGAL_Point_3<R> p + CGAL_Vector_3<R> v
returns a point obtained by translating p by the vector v.
CGAL_Point_3<R> p - CGAL_Vector_3<R> v
returns a point obtained by translating p by the vector -v.

See Also

3D Geometric Predicates, reference arrow.


Next: Class declaration of CGAL_Vector_3<R>
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. Wed, January 20, 1999.