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

2D Iso Rectangle (CGAL_Iso_rectangle_2)

Definition

An object s of the data type CGAL_Iso_rectangle is a rectangle in the Euclidean plane E2 with sides parallel to the x and y axis of the coordinate system.

Although they are represented in a canonical form by only two vertices, namely the lower left and the upper right vertex, we provide functions for ``accessing'' the other vertices as well. The vertices are returned in counterclockwise order.

Iso-oriented rectangles and bounding boxes are quite similar. The difference however is that bounding boxes have always double coordinates, whereas the coordinate type of an iso-oriented rectangle is chosen by the user.

#include <CGAL/Iso_rectangle_2.h>

Creation

CGAL_Iso_rectangle_2<R> r ( CGAL_Point_2<R> p, CGAL_Point_2<R> q);
introduces an iso-oriented rectangle r with diagonal opposite vertices p and q. Note that the object is brought in the canonical form.

Operations

bool r == r2 Test for equality: two iso-oriented rectangles are equal, iff their lower left and their upper right vertices are equal.
bool r != r2 Test for inequality.
CGAL_Point_2<R> r.vertex ( int i) returns the i'th vertex modulo 4 of r in counterclockwise order, starting with the lower left vertex.
CGAL_Point_2<R> r [ int i] returns vertex(i).
CGAL_Point_2<R> r.min () returns the lower left vertex of r (= vertex(0)).
CGAL_Point_2<R> r.max () returns the upper right vertex of r (= vertex(2)).

Predicates

bool r.is_degenerate () r is degenerate, if all vertices are collinear.
CGAL_Bounded_side r.bounded_side ( CGAL_Point_2<R> p)
returns either CGAL_ON_UNBOUNDED_SIDE, CGAL_ON_BOUNDED_SIDE, or the constant CGAL_ON_BOUNDARY, depending on where point p is.
bool r.has_on_boundary ( CGAL_Point_2<R> p)
bool r.has_on_bounded_side ( CGAL_Point_2<R> p)
bool r.has_on_unbounded_side ( CGAL_Point_2<R> p)

Miscellaneous

CGAL_Bbox r.bbox () returns a bounding box containing r.
CGAL_Iso_rectangle_2<R>
r.transform ( CGAL_Aff_transformation_2<R> t)
returns the iso-oriented rectangle obtained by applying t on the lower left and the upper right corner of r.
Precondition: The angle at a rotation must be a multiple of pi/2, otherwise the resulting rectangle does not have the same side length. Note that rotating about an arbitrary angle can even result in a degenerate iso-oriented rectangle.


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