00001
00010 #ifndef _BOARD_RECT_H_
00011 #define _BOARD_RECT_H_
00012
00013 #include <iostream>
00014 #include "board/Point.h"
00015
00016 namespace LibBoard {
00017
00022 struct Rect {
00023 float left;
00024 float top;
00025 float width;
00026 float height;
00038 Rect( float left = 0.0f, float top = 0.0f, float width = 0.0f, float height = 0.0f )
00039 :left( left ), top( top ), width( width ), height( height ) { }
00040
00041 Point topLeft() { return Point( left, top ); }
00042 Point topRight() { return Point( left + width, top ); }
00043 Point bottomLeft() { return Point( left, top - height ); }
00044 Point bottomRight() { return Point( left + width, top - height ); }
00045 };
00046
00055 Rect operator||( const Rect & rectA, const Rect & rectB );
00056
00057
00058 }
00059
00068 std::ostream & operator<<( std::ostream & out, const LibBoard::Rect & rect );
00069
00070 #endif // _RECT_H_