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

Rectangle Class Reference

#include <Geometry.h>

Collaboration diagram for Rectangle:

Collaboration graph
[legend]
List of all members.

Public Methods

 Rectangle (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 (VecPosition pos)
bool setPosRightBottom (VecPosition pos)
VecPosition getPosRightBottom (VecPosition pos)

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 300 of file Geometry.h.


Constructor & Destructor Documentation

Rectangle::Rectangle 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 1513 of file Geometry.C.

References setRectanglePoints().


Member Function Documentation

VecPosition Rectangle::getPosLeftTop VecPosition    pos
 

This method returns the top left position of the rectangle

Returns:
top left position of the rectangle

Definition at line 1560 of file Geometry.C.

References m_posLeftTop.

VecPosition Rectangle::getPosRightBottom VecPosition    pos
 

This method returns the right bottom position of the rectangle

Returns:
top right bottom of the rectangle

Definition at line 1576 of file Geometry.C.

References m_posRightBottom.

bool Rectangle::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 1542 of file Geometry.C.

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

bool Rectangle::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 1552 of file Geometry.C.

References m_posLeftTop.

bool Rectangle::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 1568 of file Geometry.C.

References m_posRightBottom.

void Rectangle::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 1522 of file Geometry.C.

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

Referenced by Rectangle().

void Rectangle::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 1533 of file Geometry.C.

References m_posLeftTop, and m_posRightBottom.


Member Data Documentation

VecPosition Rectangle::m_posLeftTop [private]
 

top left position of the rectangle

Definition at line 302 of file Geometry.h.

Referenced by getPosLeftTop(), isInside(), setPosLeftTop(), setRectanglePoints(), and show().

VecPosition Rectangle::m_posRightBottom [private]
 

bottom right position of the rectangle

Definition at line 303 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 Mar 7 00:37:56 2002 for UvA Trilearn 2001 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001