12 #ifndef _RECT_PLACEMENT_H_ 13 #define _RECT_PLACEMENT_H_ 30 TPos(
int _x,
int _y ) :
x( _x ),
y( _y ) { }
40 TRect(
int _x,
int _y,
int _w,
int _h ) :
TPos( _x, _y ),
w( _w > 0 ? _w : 0 ),
h(
45 return p.
x >=
x && p.
y >=
y && p.
x < (
x +
w) && p.
y < (
y +
h);
49 return r.
x >=
x && r.
y >=
y &&
50 (r.
x + r.
w) <= (
x +
w) && (r.
y + r.
h) <= (
y +
h);
54 return w > 0 &&
h > 0 && r.
w > 0 && r.
h > 0
55 && ( (r.
x + r.
w) >
x && r.
x < (
x +
w) && (r.
y + r.
h) >
y && r.
y < (
y +
h) );
64 return (a.
w > b.
w && a.
w > b.
h) || (a.
h > b.
w && a.
h > b.
h);
78 void Init(
int w = 1,
int h = 1 );
104 #endif // _RECT_PLACEMENT_H_ bool Intersects(const TRect &r) const
void Init(int w=1, int h=1)
std::vector< TRect > CRectArray
bool AddAtEmptySpot(TRect &r)
std::vector< TPos > CPosArray
static bool Greater(const TRect &a, const TRect &b)
bool IsFree(const TRect &r) const
bool operator==(const TPos &p) const
void AddPosition(const TPos &p)
bool Contains(const TRect &r) const
void AddRect(const TRect &r)
bool Contains(const TPos &p) const
TRect(int _x, int _y, int _w, int _h)
bool AddAtEmptySpotAutoGrow(TRect *pRect, int maxW, int maxH)
double GetTotalArea() const