In file include/csgeom/csrect.h:

## class csRect : public csBase

> Rectangle class: simple class for manipulating 2D rectangles

## Inheritance:

### Public Fields

int xmin
  Rectangle bounds.

### Public Methods

void AddAdjanced(csRect &rect)
  Add an adjanced rectangle if resulting rectangle will have larger area.
inline int Area()
  Return area of this rectangle.
inline bool Contains(int x, int y)
  Return true if a point lies within rectangle bounds.
inline bool ContainsRel(int x, int y)
  Return true if a relative point lies within rectangle bounds.
csRect()
  Create a empty rectangle.
csRect(int ixmin, int iymin, int ixmax, int iymax)
  Create a new rectangle.
csRect(csRect ©)
  Copy constructor.
inline bool Equal(int ixmin, int iymin, int ixmax, int iymax)
  Return true if rectangle is the same.
void Exclude(int ixmin, int iymin, int ixmax, int iymax)
  Subtract rectangle: find the minimal rectangle which embeds all parts of this rectangle which are not covered by given rectangle
inline int Height()
  Return the height of rectangle.
void Intersect(csRect &target)
  Intersect with another rectangle; return false if resulting rectangle is empty
void Intersect(int ixmin, int iymin, int ixmax, int iymax)
  Intersect with another rectangle; return false if resulting rectangle is empty
bool Intersects(csRect &target)
  Return true if rectangle intersects with target.
inline bool IsEmpty()
  Return true if rectangle is empty.
inline void MakeEmpty()
  Make rectangle empty.
inline void Move(int dX, int dY)
  Move rectangle by deltaX, deltaY.
inline void Normalize()
  Normalize a rectangle such that xmin <= xmax and ymin <= ymax.
inline bool operator != (csRect &rect)
  Test inequality of two rectangles.
inline void Set(csRect &target)
  Copy rectangle.
inline void Set(int ixmin, int iymin, int ixmax, int iymax)
  Set rectangle to given ixmin,iymin,ixmax,iymax position.
inline void SetPos(int x, int y)
  Set rectangle xmin,ymin position.
inline void SetSize(int w, int h)
  Set rectangle size.
void Subtract(csRect &rect)
  Alternative subtraction: find maximal area of this rectangle that is not covered by argument
void Union(csRect &target)
  Add a rectangle: find minimal rectangle that embeds both given rectangles
void Union(int ixmin, int iymin, int ixmax, int iymax)
  Add a rectangle: find minimal rectangle that embeds both given rectangles
inline int Width()
  Return the width of rectangle.

### Inherited from csBase:

## Documentation

> Rectangle class: simple class for manipulating 2D rectangles. This class is somewhat similar to Box, but uses integer coordinates and is mostly used for CrystalSpace Windowing System.

> Example of a rectangle (xmin = 0, ymin = 0, xmax = 3, ymax = 2):

>     0  1  2  3  4 ...
>     |  |  |  |  |  |
>     0 --@@@@@@@@@@--+--+--
>     @//|//|//@  |  |
>     1 --@--+--+--@--+--+--
>     @//|//|//@  |  |
>     2 --@@@@@@@@@@--+--+--
>     |  |  |  |  |  |
>     3 --+--+--+--+--+--+--
>     |  |  |  |  |  |
>     ...--+--+--+--+--+--+--

> Vertical line 'X=3' and horizontal line 'Y=2' does NOT belong to the rectangle.

`int xmin`
  Rectangle bounds.

`csRect()`
  Create a empty rectangle.

`csRect(int ixmin, int iymin, int ixmax, int iymax)`
  Create a new rectangle.

`csRect(csRect ©)`
  Copy constructor.

`void Intersect(int ixmin, int iymin, int ixmax, int iymax)`
  Intersect with another rectangle; return false if resulting rectangle is empty

`void Intersect(csRect &target)`
  Intersect with another rectangle; return false if resulting rectangle is empty

`bool Intersects(csRect &target)`
  Return true if rectangle intersects with target.

`void Union(int ixmin, int iymin, int ixmax, int iymax)`
  Add a rectangle: find minimal rectangle that embeds both given rectangles

`void Union(csRect &target)`
  Add a rectangle: find minimal rectangle that embeds both given rectangles

`void Exclude(int ixmin, int iymin, int ixmax, int iymax)`
  Subtract rectangle: find the minimal rectangle which embeds all parts of this rectangle which are not covered by given rectangle. If rectangle is fully covered by argument, it becomes empty.

`void Subtract(csRect &rect)`
  Alternative subtraction: find maximal area of this rectangle that is not covered by argument

`inline bool IsEmpty()`
  Return true if rectangle is empty.

`inline void MakeEmpty()`
  Make rectangle empty.

`inline void Set(int ixmin, int iymin, int ixmax, int iymax)`
  Set rectangle to given ixmin,iymin,ixmax,iymax position.

`inline void Set(csRect &target)`
  Copy rectangle.

`inline void SetPos(int x, int y)`
  Set rectangle xmin,ymin position.

`inline void SetSize(int w, int h)`
  Set rectangle size.

`inline void Move(int dX, int dY)`
  Move rectangle by deltaX, deltaY.

`inline int Width()`
  Return the width of rectangle.

`inline int Height()`
  Return the height of rectangle.

`inline bool Contains(int x, int y)`
  Return true if a point lies within rectangle bounds.

`inline bool ContainsRel(int x, int y)`
  Return true if a relative point lies within rectangle bounds.

`inline bool Equal(int ixmin, int iymin, int ixmax, int iymax)`
  Return true if rectangle is the same.

`inline void Normalize()`
  Normalize a rectangle such that xmin <= xmax and ymin <= ymax.

`inline int Area()`
  Return area of this rectangle.

`void AddAdjanced(csRect &rect)`
  Add an adjanced rectangle if resulting rectangle will have larger area.

`inline bool operator != (csRect &rect)`
  Test inequality of two rectangles.

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