## "Fossies" - the Fresh Open Source Software Archive

### Member "doc_html/Kernel_23/classCGAL_1_1Iso__rectangle__2.html" (8 Nov 2019, 39750 Bytes) of package /linux/misc/CGAL-5.0-doc_html.tar.xz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the project site itself.

 CGAL 5.0 - 2D and 3D Linear Geometry Kernel
CGAL::Iso_rectangle_2< Kernel > Class Template Reference

#include <CGAL/Iso_rectangle_2.h>

## Definition

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.

Is Model Of:

Kernel::IsoRectangle_2

Hashable if Kernel is a cartesian kernel and if Kernel::FT is Hashable

## 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< Kernelvertex (int i) const
returns the i'th vertex modulo 4 of r in counterclockwise order, starting with the lower left vertex.

Point_2< Kerneloperator[] (int i) const
returns vertex(i).

Point_2< Kernelmin () const
returns the lower left vertex of r (= vertex(0)).

Point_2< Kernelmax () 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< Kerneltransform (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...

## ◆ Iso_rectangle_2() [1/3]

template<typename Kernel >
 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.

## ◆ Iso_rectangle_2() [2/3]

template<typename Kernel >
 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.

Precondition
p.x()<=q.x() and p.y()<=q.y().

## ◆ Iso_rectangle_2() [3/3]

template<typename Kernel >
 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).

Precondition
hw $$\neq$$ 0.

## ◆ max_coord()

template<typename Kernel >
 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.

Precondition
$$0 \leq i \leq1$$.

## ◆ min_coord()

template<typename Kernel >
 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.

Precondition
$$0 \leq i \leq1$$.

## ◆ transform()

template<typename Kernel >
 Iso_rectangle_2 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.

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.