54 add( pos );
add( pos + size );
59 inline void reset() { bInitialized = M_FALSE; };
65 PROFILE_COL(laRect2_add);
69 if( p.x() < pt[0].x() ) pt[0].x( p.x() );
70 if( p.y() < pt[0].y() ) pt[0].y( p.y() );
71 if( p.x() > pt[1].x() ) pt[1].x( p.x() );
72 if( p.y() > pt[1].y() ) pt[1].y( p.y() );
77 bInitialized = M_TRUE;
100 inline M_BOOL intersecting(
const laRect2 &r)
const{
101 PROFILE_COL(laRect2_intersecting);
102 ASSERT(bInitialized,
"Bounding box not initialzied");
104 if(r.
pt[0].x() > pt[1].x())
return M_FALSE;
105 if(pt[0].x() > r.
pt[1].x())
return M_FALSE;
107 if(r.
pt[0].y() > pt[1].y())
return M_FALSE;
108 if(pt[0].y() > r.
pt[1].y())
return M_FALSE;
115 inline void offset(
const laPoint2 &ofs) {
136 #endif //#ifndef M_RECT_H
M_BOOL bInitialized
Validity flag.
void draw(laRenderer *r, laPoint2 &pt=laPoint2())
Draw rectangle ( primarily for debug purpoces )
void add(const laPoint2 &p)
Revert to "uninitialized" state.
laPoint2 end() const
Get the end-point.
void inflate(const laPoint2 &inf)
Add vector to the rectangle (e.g. velocity)
2D rectangle (used by the GUI and also as a simple tool for proximity testing)
Virtual interface for the Engine graphics renderer.
laPoint2 origin
Point of origin.
laPoint2 pt[2]
Rectangle coordinates (upper-left and lower-right point)