Core 1.0
IRect2 Class Reference

Axis aligned integer rectangle. More...

#include <irect.h>

Public Member Functions

 IRect2 (int, int, int)
 Create a square integer rectangle centered on a point.
 IRect2 (int, int, int, int)
 Create an integer rectangle given its opposite corners.
 IRect2 (const IPoint &, const IPoint &)
 Create an integer rectangle given its opposite corners.
 IRect2 (const QRect &)
 Create an integer rectangle from a Qt rectangle.
IRect2 Intersect (const IRect2 &) const
 Compute the intersection of two integer rectangles.

Detailed Description

Axis aligned integer rectangle.

Constructor & Destructor Documentation

◆ IRect2() [1/4]

IRect2::IRect2 ( int x,
int y,
int r )
inline

Create a square integer rectangle centered on a point.

Parameters
x,yCenter.
rHalf side length.

◆ IRect2() [2/4]

IRect2::IRect2 ( int xa,
int ya,
int xb,
int yb )
inline

Create an integer rectangle given its opposite corners.

Parameters
xa,yaLower corner.
xb,ybUpper corner.

◆ IRect2() [3/4]

IRect2::IRect2 ( const IPoint & a,
const IPoint & b )
inline

Create an integer rectangle given its opposite corners.

Parameters
a,bLower and upper corners.

◆ IRect2() [4/4]

IRect2::IRect2 ( const QRect & r)
inlineexplicit

Create an integer rectangle from a Qt rectangle.

The opposite corner is defined by QRect::right() and QRect::bottom(), thus bounds are inclusive.

Parameters
rQt rectangle.

Member Function Documentation

◆ Intersect()

IRect2 IRect2::Intersect ( const IRect2 & q) const
inline

Compute the intersection of two integer rectangles.

The resulting rectangle is empty, with a lower corner greater than the upper corner, if the rectangles do not overlap.

Parameters
qOther rectangle.