|
Jameo Core Library
|
Defines a rectangle. More...
Public Member Functions | |
| Rect () | |
| Constructor creates rectangle <0,0,0,0> | |
| Rect (double rx, double ry, double rwidth, double rheight) | |
| Constructor creates rectangle <rx,ry,rwidth,rheight. | |
| Rect (Point origin, Size size) | |
| Rect (double x, double y, const Size &size) | |
| double | x () const |
| X-Component of top left corner. | |
| double | y () const |
| Y-Component of top left corner. | |
| double | width () const |
| Width of the rectangle (along x-axis) | |
| double | height () const |
| Height of the rectangle (along y-axis) | |
| Size | size () const |
| Returns the size of the rectangle. | |
| Point | origin () const |
| Returns the position of the rectangle, which is the bottom left corner. | |
| double | left () const |
| Returns the x-coordinate of the left edge of the rectangle. | |
| double | right () const |
| Returns the x-coordinate of the right edge of the rectangle. | |
| double | top () const |
| Returns the y-coordinate of the top edge of the rectangle. | |
| double | bottom () const |
| Returns the y-coordinate of the bottom edge of the rectangle. | |
| Point | center () const |
| Returns the center point of the rectangle. | |
| Point | topLeft () const |
| Returns the top-left point. | |
| Point | topRight () const |
| Returns the top-right point. | |
| Point | bottomLeft () const |
| Returns the bottom-left point. | |
| Point | bottomRight () const |
| Returns the bottom-left point. | |
| Point | topCenter () const |
| Point | bottomCenter () const |
| Point | leftCenter () const |
| Point | rightCenter () const |
| void | setX (double x) |
| void | setY (double y) |
| void | setWidth (double width) |
| void | setHeight (double height) |
| void | setSize (const Size &sz) |
| Set the size of the rectangle. | |
| void | setSize (double width, double height) |
| Set the size of the rectangle. | |
| void | setOrigin (const Point &pt) |
| Set the position of the rectangle. | |
| void | setOrigin (double x, double y) |
| void | moveLeft (double delta) |
| void | moveRight (double delta) |
| void | moveBottom (double delta) |
| void | setTop (double top) |
| Set the top edge absolutely (and change size of rectanlge) | |
| void | setBottom (double bottom) |
| Move the bottom edge absolutely (and change size of rectanlge) | |
| void | setLeft (double left) |
| Move the left edge absolutely (and change size of rectanlge) | |
| void | setRight (double right) |
| Move the right edge absolutely (and change size of rectanlge) | |
| void | moveHorizontal (double deltaX) |
| Moves the rectangle horizontally. | |
| void | moveVertical (double deltaY) |
| Moves the rectangle vertically. | |
| void | move (const jm::Point &delta) |
| Moves the rectangle. | |
| void | alignTopLeft (const Rect &rect) |
The top-left corner of this and the other Rect are aligned. | |
| void | alignBottomLeft (const Rect &rect) |
The bottom-left corner of this and the other Rect are aligned. | |
| void | shiftTop (double deltaTop) |
| Move the top edge relatively (and resize) | |
| void | shiftLeft (double deltaLeft) |
| Move the left edge relatively (and resize) | |
| void | shiftRight (double deltaRight) |
| Move the right edge relatively (and resize) | |
| void | shiftBottom (double deltaBottom) |
| Move the bottom edge relatively (and resize) | |
| void | unionWith (const Rect &rect) |
| Enlarges this rectangle to a common rectangle with the other. | |
| void | normalize () |
| Normalized the rectangle. | |
| bool | isEmpty () const |
| Is the rectangle empty? (Size == 0) | |
| void | intersect (const Rect &other) |
| Change this rect to the intersection area of this rectangle with the other rect. | |
| Rect | intersection (const Rect &rect) const |
| Returns the rectangle that is the intersection of both rectangles. | |
| bool | contains (double px, double py) const |
| Returns true, if the point <px,py> is within this rectangle. False otherwise. | |
| bool | contains (const Point &pt) const |
| Returns true, if the point pt is within this rectangle. False otherwise. | |
| bool | contains (const Vertex2 &pt) const |
| Returns true, if the point pt is within this rectangle. False otherwise. | |
| bool | intersects (const Rect &rect) const |
| Returns true, if the rectangle rect intersects this rectangle. False otherwise. | |
Defines a rectangle.
| jm::Rect::Rect | ( | ) |
Constructor creates rectangle <0,0,0,0>
| jm::Rect::Rect | ( | double | rx, |
| double | ry, | ||
| double | rwidth, | ||
| double | rheight | ||
| ) |
Constructor creates rectangle <rx,ry,rwidth,rheight.
| rx | X-Component of the top left corner of the rect. |
| ry | Y-Component of the top left corner of the rect. |
| rwidth | Width of the rectangle (which is parallel to X-Axis) |
| rheight | Height of the rectangle (which is parallel to Y-Axis) |
| jm::Rect::Rect | ( | double | x, |
| double | y, | ||
| const Size & | size | ||
| ) |
| void jm::Rect::alignBottomLeft | ( | const Rect & | rect | ) |
The bottom-left corner of this and the other Rect are aligned.
| void jm::Rect::alignTopLeft | ( | const Rect & | rect | ) |
The top-left corner of this and the other Rect are aligned.
| double jm::Rect::bottom | ( | ) | const |
Returns the y-coordinate of the bottom edge of the rectangle.
| Point jm::Rect::bottomCenter | ( | ) | const |
| Point jm::Rect::bottomLeft | ( | ) | const |
Returns the bottom-left point.
| Point jm::Rect::bottomRight | ( | ) | const |
Returns the bottom-left point.
| Point jm::Rect::center | ( | ) | const |
Returns the center point of the rectangle.
| bool jm::Rect::contains | ( | const Point & | pt | ) | const |
Returns true, if the point pt is within this rectangle. False otherwise.
| pt | The point. |
| bool jm::Rect::contains | ( | const Vertex2 & | pt | ) | const |
Returns true, if the point pt is within this rectangle. False otherwise.
| pt | The point. |
| bool jm::Rect::contains | ( | double | px, |
| double | py | ||
| ) | const |
Returns true, if the point <px,py> is within this rectangle. False otherwise.
| px | X-Component of the point. |
| py | Y-Component of the point. |
| double jm::Rect::height | ( | ) | const |
Height of the rectangle (along y-axis)
| void jm::Rect::intersect | ( | const Rect & | other | ) |
Change this rect to the intersection area of this rectangle with the other rect.
Returns the rectangle that is the intersection of both rectangles.
| bool jm::Rect::intersects | ( | const Rect & | rect | ) | const |
Returns true, if the rectangle rect intersects this rectangle. False otherwise.
| rect | The rectangle |
| bool jm::Rect::isEmpty | ( | ) | const |
Is the rectangle empty? (Size == 0)
| double jm::Rect::left | ( | ) | const |
Returns the x-coordinate of the left edge of the rectangle.
| Point jm::Rect::leftCenter | ( | ) | const |
| void jm::Rect::move | ( | const jm::Point & | delta | ) |
Moves the rectangle.
| void jm::Rect::moveBottom | ( | double | delta | ) |
| void jm::Rect::moveHorizontal | ( | double | deltaX | ) |
Moves the rectangle horizontally.
| void jm::Rect::moveLeft | ( | double | delta | ) |
| void jm::Rect::moveRight | ( | double | delta | ) |
| void jm::Rect::moveVertical | ( | double | deltaY | ) |
Moves the rectangle vertically.
| void jm::Rect::normalize | ( | ) |
Normalized the rectangle.
Normalizing means, that a rectangle with negative width or height value becomes positive with and height values and the position is corrected in that way, that the outline of the rect remains on the same position and size.
| Point jm::Rect::origin | ( | ) | const |
Returns the position of the rectangle, which is the bottom left corner.
| double jm::Rect::right | ( | ) | const |
Returns the x-coordinate of the right edge of the rectangle.
| Point jm::Rect::rightCenter | ( | ) | const |
| void jm::Rect::setBottom | ( | double | bottom | ) |
Move the bottom edge absolutely (and change size of rectanlge)
| void jm::Rect::setHeight | ( | double | height | ) |
| void jm::Rect::setLeft | ( | double | left | ) |
Move the left edge absolutely (and change size of rectanlge)
| void jm::Rect::setOrigin | ( | const Point & | pt | ) |
Set the position of the rectangle.
| pt | The new position of the bottom left corner. |
| void jm::Rect::setOrigin | ( | double | x, |
| double | y | ||
| ) |
| void jm::Rect::setRight | ( | double | right | ) |
Move the right edge absolutely (and change size of rectanlge)
| void jm::Rect::setSize | ( | const Size & | sz | ) |
Set the size of the rectangle.
| sz | The new size. |
| void jm::Rect::setSize | ( | double | width, |
| double | height | ||
| ) |
Set the size of the rectangle.
| width | The new width of the rectangle. |
| height | The new height of the rectangle. |
| void jm::Rect::setTop | ( | double | top | ) |
Set the top edge absolutely (and change size of rectanlge)
| void jm::Rect::setWidth | ( | double | width | ) |
| void jm::Rect::setX | ( | double | x | ) |
| void jm::Rect::setY | ( | double | y | ) |
| void jm::Rect::shiftBottom | ( | double | deltaBottom | ) |
Move the bottom edge relatively (and resize)
| void jm::Rect::shiftLeft | ( | double | deltaLeft | ) |
Move the left edge relatively (and resize)
| void jm::Rect::shiftRight | ( | double | deltaRight | ) |
Move the right edge relatively (and resize)
| void jm::Rect::shiftTop | ( | double | deltaTop | ) |
Move the top edge relatively (and resize)
| Size jm::Rect::size | ( | ) | const |
Returns the size of the rectangle.
| double jm::Rect::top | ( | ) | const |
Returns the y-coordinate of the top edge of the rectangle.
| Point jm::Rect::topCenter | ( | ) | const |
| Point jm::Rect::topLeft | ( | ) | const |
Returns the top-left point.
| Point jm::Rect::topRight | ( | ) | const |
Returns the top-right point.
| void jm::Rect::unionWith | ( | const Rect & | rect | ) |
Enlarges this rectangle to a common rectangle with the other.
| double jm::Rect::width | ( | ) | const |
Width of the rectangle (along x-axis)
| double jm::Rect::x | ( | ) | const |
X-Component of top left corner.
| double jm::Rect::y | ( | ) | const |
Y-Component of top left corner.