Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# Keos::CRectangle Class Reference

Class of the rectangles 2D in integer coordinates. More...

`#include <KeosRectangle.h>`

List of all members.

## Public Member Functions

| CRectangle (const TVector2I &Start=TVector2I(0, 0), const TVector2I &Size=TVector2I(0, 0))
| Default constructor.
| CRectangle (int nLeft, int nTop, int nWidth, int nHeight)
| Constructor with 2 coordinates and 2 dimensions.
void | Set (int nLeft, int nTop, int nWidth, int nHeight)
| Reinitialize the rectangle.
int | Left () const
| Return the left side of the rectangle.
int | Right () const
| Return the right side of the rectangle.
int | Top () const
| Return the top side of the rectangle.
int | Bottom () const
| Return the bottom side of the rectangle.
int | Width () const
| Return the width of the rectangle.
int | Height () const
| Return the height of the rectangle.
TVector2I | Size () const
| Return the size of the rectangle.
TIntersection | Intersects (const TVector2I &Point) const
| Test of intersection with a point.
TIntersection | Intersects (const CRectangle &Rect) const
| Test of intersection with a rectangle.
bool | operator== (const CRectangle &Rect) const
bool | operator!= (const CRectangle &Rect) const

## Public Attributes

TVector2I | Origin
| Top-Left corner.
TVector2I | End
| Bottom-Right corner.

## Detailed Description

Class of the rectangles 2D in integer coordinates.

Definition at line 12 of file KeosRectangle.h.

## Constructor & Destructor Documentation

Keos::CRectangle::CRectangle | ( | const TVector2I & | Start = `TVector2I(0, 0)`,
|  | const TVector2I & | Size = `TVector2I(0, 0)`
| ) |

| Default constructor.

Parameters:

  | Start | (default (0,0))
  | Size | (default (0,0))

Definition at line 31 of file KeosRectangle.cpp.

Keos::CRectangle::CRectangle | ( | int | nLeft,
|  | int | nTop,
|  | int | nWidth,
|  | int | nHeight
| ) |

| Constructor with 2 coordinates and 2 dimensions. Definition at line 39 of file KeosRectangle.cpp.

## Member Function Documentation

int Keos::CRectangle::Bottom | ( |  | ) | const

| Return the bottom side of the rectangle. Definition at line 72 of file KeosRectangle.cpp. References End, and Keos::CVector2< T >::y.

int Keos::CRectangle::Height | ( |  | ) | const

| Return the height of the rectangle. Definition at line 84 of file KeosRectangle.cpp. References End, Origin, and Keos::CVector2< T >::y.

TIntersection Keos::CRectangle::Intersects | ( | const CRectangle & | Rect | ) | const

| Test of intersection with a rectangle.

Parameters:

  | Rect | Rectangle to be tested.

Returns:
  Intersection type.

Definition at line 105 of file KeosRectangle.cpp.

References End, Keos::INT_IN, Keos::INT_INTERSECTS, Keos::INT_OUT, Origin, Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

TIntersection Keos::CRectangle::Intersects | ( | const TVector2I & | Point | ) | const

| Test of intersection with a point.

Parameters:

  | Point | Point to be tested.

Returns:
  Intersection type.

Definition at line 96 of file KeosRectangle.cpp.

References End, Keos::INT_IN, Keos::INT_OUT, Origin, Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

int Keos::CRectangle::Left | ( |  | ) | const

| Return the left side of the rectangle. Definition at line 54 of file KeosRectangle.cpp. References Origin, and Keos::CVector2< T >::x.

bool Keos::CRectangle::operator!= | ( | const CRectangle & | Rect | ) | const

| Definition at line 127 of file KeosRectangle.cpp.

bool Keos::CRectangle::operator== | ( | const CRectangle & | Rect | ) | const

| Definition at line 121 of file KeosRectangle.cpp. References End, and Origin.

int Keos::CRectangle::Right | ( |  | ) | const

| Return the right side of the rectangle. Definition at line 60 of file KeosRectangle.cpp. References End, and Keos::CVector2< T >::x.

void Keos::CRectangle::Set | ( | int | nLeft,
|  | int | nTop,
|  | int | nWidth,
|  | int | nHeight
| ) |

| Reinitialize the rectangle. Definition at line 47 of file KeosRectangle.cpp. References End, Origin, and Keos::CVector2< T >::Set().

TVector2I Keos::CRectangle::Size | ( |  | ) | const

| Return the size of the rectangle. Definition at line 90 of file KeosRectangle.cpp. References End, and Origin.

int Keos::CRectangle::Top | ( |  | ) | const

| Return the top side of the rectangle. Definition at line 66 of file KeosRectangle.cpp. References Origin, and Keos::CVector2< T >::y.

int Keos::CRectangle::Width | ( |  | ) | const

| Return the width of the rectangle. Definition at line 78 of file KeosRectangle.cpp. References End, Origin, and Keos::CVector2< T >::x.

## Member Data Documentation

TVector2I Keos::CRectangle::End

| Bottom-Right corner. Definition at line 77 of file KeosRectangle.h. Referenced by Bottom(), Height(), Intersects(), operator==(), Right(), Set(), Size(), and Width().

TVector2I Keos::CRectangle::Origin

| Top-Left corner. Definition at line 75 of file KeosRectangle.h. Referenced by Height(), Intersects(), Left(), operator==(), Set(), Size(), Top(), and Width().

The documentation for this class was generated from the following files:

- KeosEngine/KeosRectangle.h
- KeosEngine/KeosRectangle.cpp