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 double left;
00024 double top;
00025 double width;
00026 double height;
00038 Rect( double left = 0.0f, double top = 0.0f, double width = 0.0f, double 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
00065 Rect operator&&( const Rect & rectA, const Rect & rectB );
00066
00067
00068 }
00069
00078 std::ostream & operator<<( std::ostream & out, const LibBoard::Rect & rect );
00079
00080 #endif // _RECT_H_