Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Rect Class Reference

#include <Geometry.h>

Collaboration diagram for Rect:

Collaboration graph
[legend]
List of all members.

Public Methods

 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 313 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 1643 of file Geometry.cpp.

References setRectanglePoints().


Member Function Documentation

VecPosition Rect::getPosLeftTop  
 

This method returns the top left position of the rectangle

Returns:
top left position of the rectangle

Definition at line 1690 of file Geometry.cpp.

References m_posLeftTop.

VecPosition Rect::getPosRightBottom  
 

This method returns the right bottom position of the rectangle

Returns:
top right bottom of the rectangle

Definition at line 1706 of file Geometry.cpp.

References 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 1672 of file Geometry.cpp.

References VecPosition::getX(), VecPosition::getY(), VecPosition::isBetweenX(), VecPosition::isBetweenY(), m_posLeftTop, and m_posRightBottom.

Referenced by WorldModel::getNrInSetInRectangle().

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 1682 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 1698 of file Geometry.cpp.

References m_posRightBottom.

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 1652 of file Geometry.cpp.

References VecPosition::getX(), VecPosition::getY(), m_posLeftTop, m_posRightBottom, max(), min(), VecPosition::setX(), and VecPosition::setY().

Referenced by Rect().

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 1663 of file Geometry.cpp.

References m_posLeftTop, and m_posRightBottom.


Member Data Documentation

VecPosition Rect::m_posLeftTop [private]
 

top left position of the rectangle

Definition at line 315 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 316 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 Fri Nov 7 11:46:06 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001