26 #ifndef _BOARD_RECT_H_ 
   27 #define _BOARD_RECT_H_ 
   52   Rect( 
double left = 0.0f, 
double top = 0.0f,
 
   53         double width = 0.0f, 
double height = 0.0f )
 
   54     :left( left ), top( top ), width( width ), height( height ) { }
 
   64         double width = 0.0f, 
double height = 0.0f )
 
   65     :left( topLeft.x ), top( topLeft.y ), width( width ), height( height ) { }
 
   76       width( bottomRight.x - topLeft.x ),
 
   77       height( topLeft.y - bottomRight.y ) { }
 
   79   Point topLeft()
 const { 
return Point( left, top ); }
 
   80   Point topRight()
 const { 
return Point( left + width, top ); }
 
   81   Point bottomLeft()
 const { 
return Point( left, top - height ); }
 
   82   Point bottomRight()
 const { 
return Point( left + width, top - height ); }
 
   83   Point center()
 const { 
return Point(left+width/2.0,top-height/2.0); }
 
   84   Point centerLeft()
 const { 
return Point(left,top-height/2.0); }
 
   85   Point centerRight()
 const { 
return Point(left+width,top-height/2.0); }
 
   86   Point centerTop()
 const { 
return Point(left+width/2.0,top); }
 
   87   Point centerBottom()
 const { 
return Point(left+width/2.0,top-height); }
 
   88   double bottom()
 const { 
return top - 
height; }
 
   89   double right()
 const { 
return left + 
width; }
 
   90   void growToContain(Point );
 
   91   bool contains(Point ) 
const;
 
   92   Rect & grow(
double margin);
 
  103 Rect operator||( 
const Rect & rectA, 
const Rect & rectB );
 
  113 Rect operator&&( 
const Rect & rectA, 
const Rect & rectB );
 
The Point structure. @copyright This source code is part of the Board project, a C++ library whose pu...
double top
Definition: Rect.h:40
Rect(Point topLeft, double width=0.0f, double height=0.0f)
Definition: Rect.h:63
Rect(double left=0.0f, double top=0.0f, double width=0.0f, double height=0.0f)
Definition: Rect.h:52
double left
Definition: Rect.h:39
Struct representing a 2D point. 
Definition: Point.h:39
Rect(Point topLeft, Point bottomRight)
Definition: Rect.h:73
std::ostream & operator<<(std::ostream &out, const LibBoard::Rect &rect)
Definition: Rect.cpp:105
double height
Definition: Rect.h:42
Struct representing a rectangle on the plane. 
Definition: Rect.h:38
double width
Definition: Rect.h:41