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

CGAL::Point_3<R>

Definition

An object of the class Point_3<R> 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>.

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).
Precondition: hw Kernel::RT(0).

Operations

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

bool p.operator!= ( 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.operator[] ( 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.

Operators

The following operations can be applied on points:

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

Point_3<R> operator+ ( p, Vector_3<R> v)
returns the point obtained by translating p by the vector v.

Point_3<R> operator- ( p, Vector_3<R> v)
returns the point obtained by translating p by the vector -v.

See Also

Kernel::Point_3


Next: Ray_3<R>
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
www.cgal.org. Aug 13, 2001.