Board 0.9.6
|
Struct representing a rectangle on the plane. More...
#include <Rect.h>
Public Member Functions | |
Rect (double left=0.0, double top=0.0, double width=0.0, double height=0.0) | |
Rect (Point topLeft, double width=0.0, double height=0.0) | |
Rect (Point topLeft, Point bottomRight) | |
Point | topLeft () const |
topLeft Top-left point of the rectangle | |
Point | topRight () const |
topRight Top-right point of the rectangle | |
Point | bottomLeft () const |
bottomLeft Bottom-left point of the rectangle | |
Point | bottomRight () const |
bottomRight Bottom-right point of the rectangle | |
Point | center () const |
center The center of the rectangle | |
Point | centerLeft () const |
centerLeft The center of the left border of the rectangle | |
Point | centerRight () const |
centerRight The center of the right border of the rectangle | |
Point | centerTop () const |
centerTop The center of the top border of the rectangle | |
Point | centerBottom () const |
centerBottom The center of the bottom border of the rectangle | |
double | bottom () const |
The y coordinate of the bottom of the rectangle. | |
double | right () const |
The x coordinate of the right side of the rectangle. | |
double | diameter () const |
diameter | |
void | clear () |
Set to a rectangle with zero width and height at position (0,0) | |
Rect & | growToContain (const Point &p) |
Grow the rectangle so that it contains the point p. | |
Rect & | growToContain (const std::vector< Point > &points) |
Grow the rectangle so that it contains a set of points. | |
bool | contains (Point p) const |
Check whether or not a point is contained in the rectangle (including its border) | |
bool | strictlyContains (Point p) const |
Check whether or not a point is strictly contained in the rectangle. | |
bool | intersects (const Rect &other) const |
Check whether the rectangle intersects another rectangle. | |
bool | strictlyIntersects (const Rect &other) const |
Check whether the rectangle strictly intersects another rectangle. | |
Rect & | grow (double margin) |
Grow the rectangle by a given distance (margin) in each direction. | |
Rect | growed (double margin) |
Return the rectangle growed by a given distance (margin) in each direction. | |
bool | isNull () const |
Check if a rectangle is null (i.e., zero sized) | |
Public Attributes | |
double | left |
double | top |
double | width |
double | height |
Struct representing a rectangle on the plane.
The Rectangle structure.
|
inline |
Rect constructor
left | x coordinate of the left border of the rectangle |
top | y coordinate of the top border of the rectangle |
width | width of the rectangle |
height | height of the rectangle |
|
inline |
Rect constructor.
topLeft | The top-left point of the rectangle |
width | Width of the rectangle |
height | Height of the rectangle |
Rect constructor.
topLeft | The top-left point of the rectangle. |
bottomRight | The bottom-right point of the rectangle. |
|
inline |
The y coordinate of the bottom of the rectangle.
Referenced by LibBoard::ShapeList::append(), LibBoard::boardFontText(), LibBoard::hachures(), and LibBoard::Board::saveEPS().
|
inline |
bottomLeft Bottom-left point of the rectangle
References height, left, and top.
Referenced by intersects(), main(), and strictlyIntersects().
|
inline |
bottomRight Bottom-right point of the rectangle
References height, left, top, and width.
Referenced by intersects(), main(), and strictlyIntersects().
|
inline |
center The center of the rectangle
References height, left, top, and width.
Referenced by LibBoard::ShapeList::append(), LibBoard::Path::center(), LibBoard::Shape::center(), LibBoard::circled(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::TransformFIG::setBoundingBox(), and LibBoard::TransformSVG::setBoundingBox().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set to a rectangle with zero width and height at position (0,0)
References height, left, top, and width.
Referenced by LibBoard::Tools::getEPSBoundingBox().
bool LibBoard::Rect::contains | ( | Point | p | ) | const |
Check whether or not a point is contained in the rectangle (including its border)
p | A point |
References height, left, top, width, LibBoard::Point::x, and LibBoard::Point::y.
Referenced by intersects().
|
inline |
Rect & LibBoard::Rect::grow | ( | double | margin | ) |
Grow the rectangle by a given distance (margin) in each direction.
margin | The margin to be added |
References height, left, top, and width.
Referenced by LibBoard::Ellipse::boundingBox(), LibBoard::framed(), growed(), and main().
Rect LibBoard::Rect::growed | ( | double | margin | ) |
Return the rectangle growed by a given distance (margin) in each direction.
margin | The margin to be added |
References grow().
Referenced by merge().
Grow the rectangle so that it contains the point p.
p | A point |
References height, left, top, width, LibBoard::Point::x, and LibBoard::Point::y.
Referenced by LibBoard::Path::boundingBox(), growToContain(), and LibBoard::Tools::pathBoundingBox().
Grow the rectangle so that it contains a set of points.
points | A set of points |
References growToContain(), and point().
bool LibBoard::Rect::intersects | ( | const Rect & | other | ) | const |
Check whether the rectangle intersects another rectangle.
other | Another rectangle |
References bottomLeft(), bottomRight(), contains(), topLeft(), and topRight().
|
inline |
Check if a rectangle is null (i.e., zero sized)
Referenced by LibBoard::operator||().
|
inline |
The x coordinate of the right side of the rectangle.
Referenced by LibBoard::ShapeList::append(), and LibBoard::Board::saveEPS().
bool LibBoard::Rect::strictlyContains | ( | Point | p | ) | const |
Check whether or not a point is strictly contained in the rectangle.
p | A point |
References height, left, top, width, LibBoard::Point::x, and LibBoard::Point::y.
Referenced by strictlyIntersects().
bool LibBoard::Rect::strictlyIntersects | ( | const Rect & | other | ) | const |
Check whether the rectangle strictly intersects another rectangle.
other | Another rectangle |
References bottomLeft(), bottomRight(), strictlyContains(), topLeft(), and topRight().
|
inline |
topLeft Top-left point of the rectangle
Referenced by intersects(), main(), and strictlyIntersects().
|
inline |
topRight Top-right point of the rectangle
References left, top, and width.
Referenced by intersects(), main(), and strictlyIntersects().
double LibBoard::Rect::height |
Height of the rectangle.
Referenced by LibBoard::ShapeList::append(), bottom(), bottomLeft(), bottomRight(), center(), centerBottom(), centerLeft(), centerRight(), clear(), contains(), diameter(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawRectangle(), LibBoard::Board::fillRectangle(), LibBoard::Group::flushFIG(), LibBoard::Image::flushPostscript(), grow(), growToContain(), isNull(), merge(), LibBoard::operator&&(), operator<<(), LibBoard::operator||(), LibBoard::rectangle(), LibBoard::rectangle(), LibBoard::Shape::resize(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Shape::scaleToHeight(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::TransformFIG::setBoundingBox(), LibBoard::TransformSVG::setBoundingBox(), LibBoard::Board::setClippingRectangle(), strictlyContains(), and LibBoard::tiling().
double LibBoard::Rect::left |
Coordinate of the left side.
Referenced by LibBoard::ShapeList::append(), LibBoard::boardFontText(), bottomLeft(), bottomRight(), center(), centerBottom(), centerLeft(), centerRight(), centerTop(), clear(), contains(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawRectangle(), LibBoard::Board::fillRectangle(), LibBoard::Group::flushFIG(), grow(), growToContain(), LibBoard::operator&&(), operator<<(), LibBoard::operator||(), LibBoard::rectangle(), LibBoard::rectangle(), right(), LibBoard::Board::saveEPS(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::Board::setClippingRectangle(), strictlyContains(), LibBoard::tiling(), topLeft(), and topRight().
double LibBoard::Rect::top |
Coordinate of the upper side.
Referenced by LibBoard::ShapeList::append(), bottom(), bottomLeft(), bottomRight(), center(), centerBottom(), centerLeft(), centerRight(), centerTop(), clear(), contains(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawRectangle(), LibBoard::Board::fillRectangle(), LibBoard::Group::flushFIG(), grow(), growToContain(), LibBoard::hachures(), LibBoard::operator&&(), operator<<(), LibBoard::operator||(), LibBoard::rectangle(), LibBoard::rectangle(), LibBoard::Board::saveEPS(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::Board::setClippingRectangle(), strictlyContains(), LibBoard::tiling(), topLeft(), and topRight().
double LibBoard::Rect::width |
Width of the rectangle.
Referenced by LibBoard::ShapeList::append(), bottomRight(), center(), centerBottom(), centerRight(), centerTop(), clear(), contains(), diameter(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawRectangle(), LibBoard::Board::fillRectangle(), LibBoard::Group::flushFIG(), LibBoard::Image::flushPostscript(), grow(), growToContain(), isNull(), merge(), LibBoard::operator&&(), operator<<(), LibBoard::operator||(), LibBoard::rectangle(), LibBoard::rectangle(), LibBoard::Shape::resize(), right(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Shape::scaleToWidth(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::TransformFIG::setBoundingBox(), LibBoard::TransformSVG::setBoundingBox(), LibBoard::Board::setClippingRectangle(), strictlyContains(), text(), LibBoard::tiling(), and topRight().