Rect Class Reference

#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


Detailed Description

This class represents a rectangle. A rectangle is defined by two VecPositions the one at the upper left corner and the one at the right bottom.

Definition at line 319 of file Geometry.h.


Constructor & Destructor Documentation

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).

Parameters:
pos first point that defines corner of rectangle
pos2 second point that defines other corner of rectangle
Returns:
rectangle with 'pos' and 'pos2' as opposite corners.

Definition at line 1653 of file Geometry.cpp.

References setRectanglePoints().


Member Function Documentation

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 ).

Parameters:
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.

Parameters:
pos position which is checked whether it lies in rectangle
Returns:
true when 'pos' lies in the rectangle, false otherwise

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.

Parameters:
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

Parameters:
pos new top left position of the rectangle
Returns:
true when update was successful

Definition at line 1692 of file Geometry.cpp.

References m_posLeftTop.

VecPosition Rect::getPosLeftTop (  ) 

This method returns the top left position of the rectangle

Returns:
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

Parameters:
pos new right bottom position of the rectangle
Returns:
true when update was succesfull

Definition at line 1708 of file Geometry.cpp.

References m_posRightBottom.

VecPosition Rect::getPosRightBottom (  ) 

This method returns the right bottom position of the rectangle

Returns:
top right bottom of the rectangle

Definition at line 1716 of file Geometry.cpp.

References m_posRightBottom.


Field Documentation

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().


The documentation for this class was generated from the following files:
Generated on Thu Apr 26 22:45:31 2007 for GangOfSix(GOS)-RoboCupTeamProject by  doxygen 1.5.1-p1