CGAL 4.13.2 - 2D and 3D Linear Geometry Kernel
|
#include <CGAL/Iso_rectangle_2.h>
An object r
of the data type Iso_rectangle_2
is a rectangle in the Euclidean plane \( \E^2\) 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.
Creation | |
Iso_rectangle_2 (const Point_2< Kernel > &p, const Point_2< Kernel > &q) | |
introduces an iso-oriented rectangle r with diagonal opposite vertices p and q . More... | |
Iso_rectangle_2 (const Point_2< Kernel > &p, const Point_2< Kernel > &q, int) | |
introduces an iso-oriented rectangle r with diagonal opposite vertices p and q . More... | |
Iso_rectangle_2 (const Point_2< Kernel > &left, const Point_2< Kernel > &right, const Point_2< Kernel > &bottom, const Point_2< Kernel > &top) | |
introduces an iso-oriented rectangle r whose minimal \( x\) coordinate is the one of left , the maximal \( x\) coordinate is the one of right , the minimal \( y\) coordinate is the one of bottom , the maximal \( y\) coordinate is the one of top . | |
Iso_rectangle_2 (const Kernel::RT &min_hx, const Kernel::RT &min_hy, const Kernel::RT &max_hx, const Kernel::RT &max_hy, const Kernel::RT &hw=RT(1)) | |
introduces an iso-oriented rectangle r with diagonal opposite vertices (min_hx/hw , min_hy/hw ) and (max_hx/hw , max_hy/hw ). More... | |
Iso_rectangle_2 (const Bbox_2 &bbox) | |
If Kernel::RT is constructible from double, introduces an iso-oriented rectangle from bbox . | |
Operations | |
bool | operator== (const Iso_rectangle_2< Kernel > &r2) const |
Test for equality: two iso-oriented rectangles are equal, iff their lower left and their upper right vertices are equal. | |
bool | operator!= (const Iso_rectangle_2< Kernel > &r2) const |
Test for inequality. | |
Point_2< Kernel > | vertex (int i) const |
returns the i'th vertex modulo 4 of r in counterclockwise order, starting with the lower left vertex. | |
Point_2< Kernel > | operator[] (int i) const |
returns vertex(i) . | |
Point_2< Kernel > | min () const |
returns the lower left vertex of r (= vertex(0) ). | |
Point_2< Kernel > | max () const |
returns the upper right vertex of r (= vertex(2) ). | |
Kernel::FT | xmin () const |
returns the \( x\) coordinate of lower left vertex of r . | |
Kernel::FT | ymin () const |
returns the \( y\) coordinate of lower left vertex of r . | |
Kernel::FT | xmax () const |
returns the \( x\) coordinate of upper right vertex of r . | |
Kernel::FT | ymax () const |
returns the \( y\) coordinate of upper right vertex of r . | |
Kernel::FT | min_coord (int i) const |
returns the i 'th Cartesian coordinate of the lower left vertex of r . More... | |
Kernel::FT | max_coord (int i) const |
returns the i 'th Cartesian coordinate of the upper right vertex of r . More... | |
Predicates | |
bool | is_degenerate () const |
r is degenerate, if all vertices are collinear. | |
Bounded_side | bounded_side (const Point_2< Kernel > &p) const |
returns either ON_UNBOUNDED_SIDE, ON_BOUNDED_SIDE, or the constant ON_BOUNDARY, depending on where point p is. | |
bool | has_on_boundary (const Point_2< Kernel > &p) const |
bool | has_on_bounded_side (const Point_2< Kernel > &p) const |
bool | has_on_unbounded_side (const Point_2< Kernel > &p) const |
Miscellaneous | |
Kernel::FT | area () const |
returns the area of r . | |
Bbox_2 | bbox () const |
returns a bounding box containing r . | |
Iso_rectangle_2< Kernel > | transform (const Aff_transformation_2< Kernel > &t) const |
returns the iso-oriented rectangle obtained by applying t on the lower left and the upper right corner of r . More... | |
CGAL::Iso_rectangle_2< Kernel >::Iso_rectangle_2 | ( | const Point_2< Kernel > & | p, |
const Point_2< Kernel > & | q | ||
) |
introduces an iso-oriented rectangle r
with diagonal opposite vertices p
and q
.
Note that the object is brought in the canonical form.
CGAL::Iso_rectangle_2< Kernel >::Iso_rectangle_2 | ( | const Point_2< Kernel > & | p, |
const Point_2< Kernel > & | q, | ||
int | |||
) |
introduces an iso-oriented rectangle r
with diagonal opposite vertices p
and q
.
The int
argument value is only used to distinguish the two overloaded functions.
p.x()<=q.x()
and p.y()<=q.y()
. CGAL::Iso_rectangle_2< Kernel >::Iso_rectangle_2 | ( | const Kernel::RT & | min_hx, |
const Kernel::RT & | min_hy, | ||
const Kernel::RT & | max_hx, | ||
const Kernel::RT & | max_hy, | ||
const Kernel::RT & | hw = RT(1) |
||
) |
introduces an iso-oriented rectangle r
with diagonal opposite vertices (min_hx/hw
, min_hy/hw
) and (max_hx/hw
, max_hy/hw
).
hw
\( \neq\) 0. Kernel::FT CGAL::Iso_rectangle_2< Kernel >::max_coord | ( | int | i | ) | const |
returns the i
'th Cartesian coordinate of the upper right vertex of r
.
Kernel::FT CGAL::Iso_rectangle_2< Kernel >::min_coord | ( | int | i | ) | const |
returns the i
'th Cartesian coordinate of the lower left vertex of r
.
Iso_rectangle_2<Kernel> CGAL::Iso_rectangle_2< Kernel >::transform | ( | const Aff_transformation_2< Kernel > & | t | ) | const |
returns the iso-oriented rectangle obtained by applying t
on the lower left and the upper right corner of r
.