Rect class
The Rect class is used to represent a rectangle comprising two coordinate pairs. Note that this is NOT the same as a rectangle object which is a database object instead.
Rect::Rect()
Creates a Rect object r. The rectangle coordinates are set to invalid i.e. llx = +infinity, urx = -infinity etc.
Rect::Rect(const Point &ll, const Point &ur)
Creates a Rect object r and initialises it with Point types ll, ur.
Rect::Rect(int32_t llx, int32_t lly, int32_t urx, int32_t ury)
Creates a Rect object and initialises its coordinates.
int32_t Rect::left()
int32_t Rect::bottom()
int32_t Rect::right()
int32_t Rect::top()
Get the specified Rect coordinate.
Rect::setLeft(int32_t x)
Rect::setBottom(int32_t y)
Rect::setRight(int32_t x)
Rect::setTop(int32_t y)
Set the specified Rect coordinate.
Point Rect::getLL()
Point Rect::getLR()
Point Rect::getUL()
Point Rect::getUR()
Get the Rect coordinates as a Point.
Rect::invalidate()
Set the Rect to invalid, i.e. llx = +infinity, urx = -infinity etc.
bool Rect::isNull()
Returns true if the Rect is zero area.
Point Rect::at(int32_t idx) const
Returns the Rect coordinate by index. Index must be from 0-3.
Edge Rect::Edge(int32_t idx) const
Returns the Rect Edge by index. Index must be from 0-3.
Rect::getEdge(const int32_t idx, Point & p0, Point & p1) const
Rect::getEdgeF(const int32_t idx, PointF &p0, PointF &p1) const
Get the Rect edge points by index. Index must be from 0-3.
Edge Rect::getEdge(const int32_t idx) const
EdgeF Rect::getEdgeF(const int32_t idx) const
Get the Rect edges by index. Index must be from 0-3.
Rect::operator == (const Rect &other)
Returns true if this Rect is equal to the other Rect.
Rect::operator != (const Rect &other)
Returns true if this Rect is not equal to the other Rect.
Rect::operator < (const Rect &other)
Returns true if this Rect is less than the other Rect.
Rect::operator > (const Rect &other)
Returns true if this Rect is less than the other Rect.
Rect::scale(float64_t s)
Rect::scale(int32_t s)
Scale a Rect coordinates by dividing them by s.
Rect Rect::offset(int32_t x, int32_t y)
Returns a Rect offset by the specified x and y distances.
Rect Rect::offset(const Point &p)
Returns a Rect offset by the specified Point p.
Rect Rect::MoveTo(const Point &p)
Moves a Rect's lower left to the specified Point p.
Rect::width(int w)
Set a Rect's width. The lower left of the Rect remains the same.
int32_t Rect::width()
Get the width of a Rect.
Rect::height(int32_t h)
Set the height of a Rect. The lower left rof the Rect emains the same.
int32_t Rect::height()
Get the height of a Rect.
Point Rect::centre()
Get the centre point of a Rect.
bool Rect::isSquare()
Returns true is the rectangle is square.
Rect::transform(orient_t orient, const Point &p)
Transforms a Rect using Point p and orientation orient.
Rect::swapxy()
Swaps the X and Y coordinates of a Rect.
Rect::unionWith(const Rect &p)
Rect r is set to the union of the Rects r and p, i.e. the bounding box of both.
Rect::unionWith(const Point &p)
Rect r is set to the union of itself and Point p, i.e. the bounding box of both.
bool Rect::touchOrOverlaps(int32_t x, int32_t y)
Returns true if the Rect touches or overlaps the point x, y.
bool Rect::touchOrOverlaps(int32_t xlo, int32_t ylo, int32_t xhi, int32_t yhi)
Returns true if the Rect touches or overlaps the rectangle formed by xlo, ylo, xhi, yhi.
bool Rect::touchOrOverlaps(const Rect &r)
Returns true if the Rect touches or overlaps the Rect r.
bool Rect::touch(int32_t x, int32_t y)
Returns true if the Rect touches the point x, y.
bool Rect::touch(int32_t xlo, int32_t ylo, int32_t xhi, int32_t yhi)
Returns true if the Rect touches the rectangle formed by xlo, ylo, xhi, yhi; returns false otherwise.
bool Rect::touch(const Rect &r)
Returns true if the Rect touches the Rect r.
bool Rect::overlaps(int32_t x, int32_t y)
Returns true if the Rect overlaps the point x, y.
bool Rect::overlaps(int32_t xlo, int32_t ylo, int32_t xhi, int32_t yhi)
Returns true if the Rect overlaps the rectangle formed by xlo, ylo, xhi, yhi.
bool Rect::overlaps(const Rect &p)
Returns true if the Rect overlaps the Rect p.
bool Rect::contains(int32_t x, int32_t y)
Returns true if the Rect contains the point x, y.
bool Rect::contains(int32_t xlo, int32_t ylo, int32_t xhi, int32_t yhi)
Returns true if the Rect contains the rectangle formed by xlo, ylo, xhi, yhi.
bool Rect::contains(const Rect &p)
Returns true if the Rect contains the Rect p.
Rect::intersectsWith(const Rect &p)
Modifies this Rect to the intersection of itself and Rect p.
Rect Rect::intersectsWith(const Rect &r) const
Returns a rectangle which is the intersection of this Rect and r.