#include <Geometry.h>
Public Member Functions | |
Rect (VecPosition pos, VecPosition pos2) | |
void | show (ostream &os=cout) |
bool | isInside (VecPosition pos) |
void | setRectanglePoints (VecPosition pos1, VecPosition pos2) |
bool | setPosLeftTop (VecPosition pos) |
VecPosition | getPosLeftTop () |
bool | setPosRightBottom (VecPosition pos) |
VecPosition | getPosRightBottom () |
Private Attributes | |
VecPosition | m_posLeftTop |
VecPosition | m_posRightBottom |
Definition at line 319 of file Geometry.h.
Rect::Rect | ( | VecPosition | pos, | |
VecPosition | pos2 | |||
) |
This is the constructor of a Rectangle. Two points will be given. The order does not matter as long as two opposite points are given (left top and right bottom or right top and left bottom).
pos | first point that defines corner of rectangle | |
pos2 | second point that defines other corner of rectangle |
Definition at line 1653 of file Geometry.cpp.
References setRectanglePoints().
void Rect::show | ( | ostream & | os = cout |
) |
This method prints the rectangle to the specified output stream in the format rect( top_left_point, bottom_right_point ).
os | output stream to which rectangle is written. |
Definition at line 1673 of file Geometry.cpp.
References m_posLeftTop, and m_posRightBottom.
bool Rect::isInside | ( | VecPosition | pos | ) |
This method determines whether the given position lies inside the current rectangle.
pos | position which is checked whether it lies in rectangle |
Definition at line 1682 of file Geometry.cpp.
References VecPosition::getX(), VecPosition::getY(), VecPosition::isBetweenX(), VecPosition::isBetweenY(), m_posLeftTop, and m_posRightBottom.
Referenced by WorldModel::getClosestRelativeInSet(), and WorldModel::getNrInSetInRectangle().
void Rect::setRectanglePoints | ( | VecPosition | pos1, | |
VecPosition | pos2 | |||
) |
This method sets the upper left and right bottom point of the current rectangle.
pos | first point that defines corner of rectangle | |
pos2 | second point that defines other corner of rectangle |
Definition at line 1662 of file Geometry.cpp.
References VecPosition::getX(), VecPosition::getY(), m_posLeftTop, m_posRightBottom, max(), min(), VecPosition::setX(), and VecPosition::setY().
Referenced by Rect().
bool Rect::setPosLeftTop | ( | VecPosition | pos | ) |
This method sets the top left position of the rectangle
pos | new top left position of the rectangle |
Definition at line 1692 of file Geometry.cpp.
References m_posLeftTop.
VecPosition Rect::getPosLeftTop | ( | ) |
This method returns the top left position of the rectangle
Definition at line 1700 of file Geometry.cpp.
References m_posLeftTop.
bool Rect::setPosRightBottom | ( | VecPosition | pos | ) |
This method sets the right bottom position of the rectangle
pos | new right bottom position of the rectangle |
Definition at line 1708 of file Geometry.cpp.
References m_posRightBottom.
VecPosition Rect::getPosRightBottom | ( | ) |
This method returns the right bottom position of the rectangle
Definition at line 1716 of file Geometry.cpp.
References m_posRightBottom.
VecPosition Rect::m_posLeftTop [private] |
top left position of the rectangle
Definition at line 321 of file Geometry.h.
Referenced by getPosLeftTop(), isInside(), setPosLeftTop(), setRectanglePoints(), and show().
VecPosition Rect::m_posRightBottom [private] |
bottom right position of the rectangle
Definition at line 322 of file Geometry.h.
Referenced by getPosRightBottom(), isInside(), setPosRightBottom(), setRectanglePoints(), and show().