CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Rect Class Reference

Rectangle. More...

#include <cc/Rect>

Public Member Functions

 Rect ()=default
 Create an empty rectangle.
 
 Rect (const Size &size)
 Create a rectangle of given size.
 
 Rect (const Point &pos, const Size &size)
 Create a rectangle of given size located at pos.
 
 Rect (double x0, double y0, double x1, double y1)
 Create a rectangle covering the ranges [x0, x1) and [y0, y1)
 
 operator bool () const
 Area is greate than zero.
 
Point pos () const
 Get position.
 
void pos (Point newValue)
 Set position
 
void pos (double x, double y)
 Set position
 
Size size () const
 Get size.
 
void size (Size newValue)
 Set size
 
void size (double w, double h)
 Set size
 
double x () const
 Get pos()[0].
 
double y () const
 Get pos()[1].
 
double width () const
 Get size()[0].
 
double height () const
 Get size()[1].
 
double x0 () const
 Get pos()[0].
 
double y0 () const
 Get pos()[1];.
 
double x1 () const
 Get pos()[0] + size()[0].
 
double y1 () const
 Get pos()[1] + size()[1].
 
bool operator== (const Rect &b)
 Equal to operator.
 
bool operator!= (const Rect &b)
 Not equal to operator.
 
bool contains (const Rect &b) const
 Check if b is covered by this rectangle.
 
bool contains (const Point &b) const
 Check if b is covered by this rectangle.
 

Detailed Description

Rectangle.

Constructor & Destructor Documentation

◆ Rect() [1/4]

Rect ( )
default

Create an empty rectangle.

◆ Rect() [2/4]

Rect ( const Size & size)

Create a rectangle of given size.

◆ Rect() [3/4]

Rect ( const Point & pos,
const Size & size )

Create a rectangle of given size located at pos.

◆ Rect() [4/4]

Rect ( double x0,
double y0,
double x1,
double y1 )

Create a rectangle covering the ranges [x0, x1) and [y0, y1)

Member Function Documentation

◆ operator bool()

operator bool ( ) const
explicit

Area is greate than zero.

◆ pos() [1/3]

Point pos ( ) const

Get position.

◆ pos() [2/3]

void pos ( Point newValue)

Set position

◆ pos() [3/3]

void pos ( double x,
double y )

Set position

◆ size() [1/3]

Size size ( ) const

Get size.

◆ size() [2/3]

void size ( Size newValue)

Set size

◆ size() [3/3]

void size ( double w,
double h )

Set size

◆ x()

double x ( ) const

Get pos()[0].

◆ y()

double y ( ) const

Get pos()[1].

◆ width()

double width ( ) const

Get size()[0].

◆ height()

double height ( ) const

Get size()[1].

◆ x0()

double x0 ( ) const

Get pos()[0].

◆ y0()

double y0 ( ) const

Get pos()[1];.

◆ x1()

double x1 ( ) const

Get pos()[0] + size()[0].

◆ y1()

double y1 ( ) const

Get pos()[1] + size()[1].

◆ operator==()

bool operator== ( const Rect & b)

Equal to operator.

◆ operator!=()

bool operator!= ( const Rect & b)

Not equal to operator.

◆ contains() [1/2]

bool contains ( const Rect & b) const

Check if b is covered by this rectangle.

◆ contains() [2/2]

bool contains ( const Point & b) const

Check if b is covered by this rectangle.