class Rectangle

rectangle ADT, defined by x, y, width and height.

Public Fields

static const Rectangle ZERO
int x
the left x-coordinate of the rectangle
int y
the top y coordinate of the rectangle
int width
the width of the rectangle
int height
the height of the rectangle

Public Methods

Rectangle (int a = 0, int b = 0, int w = 0, int h=0)
Construct and initialize new rectangle.
Rectangle (int w, int h)
Construct and initialize new rectangle.
Rectangle (int d)
Construct and initialize new rectangle.
Rectangle (Point origin, Point extent)
Construct and initialize new rectangle.
void Set (int a, int b, int w, int h)
Reshape rectangle.
void SetPosition (int a, int b)
Set rectangle position.
void Move (int a, int b)
Move rectangle position.
bool Inside (Point p) const
Return if point (a,b) is inside rectangle.
bool Inside (int a, int b) const
Return if point (a,b) is inside rectangle.
bool Intersects (Rectangle* r) const
Return if rectangle r intersects with 'this'.
friend bool operator== (const Rectangle &x, const Rectangle &y)
Return whether rectangles are equal.
friend bool operator!= (const Rectangle &x, const Rectangle &y)
Return whether rectangles are unequal.
friend ostream& operator<< (ostream &s, const Rectangle r)
Write string representation to ostream.
friend istream& operator>> (istream &s, Rectangle &r)
Read string representation from istream.

Documentation

rectangle ADT, defined by x, y, width and height.
static const Rectangle ZERO

Rectangle(int a = 0, int b = 0, int w = 0, int h=0)
Construct and initialize new rectangle.

Rectangle(int w, int h)
Construct and initialize new rectangle.

Rectangle(int d)
Construct and initialize new rectangle.

Rectangle(Point origin, Point extent)
Construct and initialize new rectangle.

void Set(int a, int b, int w, int h)
Reshape rectangle.

void SetPosition(int a, int b)
Set rectangle position.

void Move(int a, int b)
Move rectangle position.

bool Inside(Point p) const
Return if point (a,b) is inside rectangle.

bool Inside(int a, int b) const
Return if point (a,b) is inside rectangle.

bool Intersects(Rectangle* r) const
Return if rectangle r intersects with 'this'.

friend bool operator==(const Rectangle &x, const Rectangle &y)
Return whether rectangles are equal.

friend bool operator!=(const Rectangle &x, const Rectangle &y)
Return whether rectangles are unequal.

friend ostream& operator<<(ostream &s, const Rectangle r)
Write string representation to ostream.

friend istream& operator>>(istream &s, Rectangle &r)
Read string representation from istream.

int x
the left x-coordinate of the rectangle

int y
the top y coordinate of the rectangle

int width
the width of the rectangle

int height
the height of the rectangle


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de