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

3D Point (Point_3)

Definition

An object of the class Point_3 is a point in the three-dimensional Euclidean space 3.

Remember that R::RT and R::FT denote a ring type and a field type. For the representation class Cartesian<T>, the two types are equivalent. However, for the representation class Homogeneous<T> the ring type is R::RT is equal to T and the field type is R::FT is equal to Quotient<T>.

#include <CGAL/Point_3.h>

Creation

Point_3<R> p ( Origin ORIGIN);
introduces a point with Cartesian coordinates(0,0,0).


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).

Bbox_3 p.bbox () returns a bounding box containing p.

Point_3<R> p.transform ( Aff_transformation_3<R> t)
returns the point obtained by applying t on p.

The following operations can be applied on points:

Vector_3<R> p - q returns the difference vector between q and p. You can substitute ORIGIN for either p or q, but not both.

Point_3<R> p + Vector_3<R> v
returns a point obtained by translating p by the vector v.

Point_3<R> p - Vector_3<R> v
returns a point obtained by translating p by the vector -v.

See Also

3D Geometric Predicates, reference.


Next: Class declaration of Vector_3<R>
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The GALIA project. Jan 18, 2000.