DGtal  1.3.beta
Rect.h
1 /* -*- mode: c++ -*- */
9 /*
10  * \@copyright This File is part of the Board library which is
11  * licensed under the terms of the GNU Lesser General Public Licence.
12  * See the LICENCE file for further details.
13  */
14 #ifndef _BOARD_RECT_H_
15 #define _BOARD_RECT_H_
16 
17 #include <iostream>
18 #include "Board/Point.h"
19 
20 namespace LibBoard {
21 
26 struct Rect {
27 
28  double left;
29  double top;
30  double width;
31  double height;
42  Rect( double leftX = 0.0f, double topY = 0.0f, double rectWidth = 0.0f, double rectHeight = 0.0f )
43  :left( leftX ), top( topY ), width( rectWidth ), height( rectHeight ) { }
44 
45  Point topLeft() { return Point( left, top ); }
46  Point topRight() { return Point( left + width, top ); }
47  Point bottomLeft() { return Point( left, top - height ); }
48  Point bottomRight() { return Point( left + width, top - height ); }
49 };
50 
59 Rect operator||( const Rect & rectA, const Rect & rectB );
60 
69 Rect operator&&( const Rect & rectA, const Rect & rectB );
70 
71 
72 } // mamespace BoardLib
73 
82 std::ostream & operator<<( std::ostream & out, const LibBoard::Rect & rect );
83 
84 #endif // _RECT_H_
LibBoard::Rect::bottomRight
Point bottomRight()
Definition: Rect.h:48
LibBoard::operator||
Rect operator||(const Rect &rectA, const Rect &rectB)
Definition: Rect.cpp:20
LibBoard::Rect::top
double top
Definition: Rect.h:29
LibBoard::Rect
Struct representing a rectangle on the plane.
Definition: Rect.h:26
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
LibBoard::Point
Struct representing a 2D point.
Definition: Point.h:27
LibBoard::Rect::left
double left
Definition: Rect.h:28
LibBoard::Rect::topRight
Point topRight()
Definition: Rect.h:46
LibBoard::Rect::Rect
Rect(double leftX=0.0f, double topY=0.0f, double rectWidth=0.0f, double rectHeight=0.0f)
Definition: Rect.h:42
LibBoard::Rect::bottomLeft
Point bottomLeft()
Definition: Rect.h:47
LibBoard
Definition: Board.cpp:87
LibBoard::Rect::width
double width
Definition: Rect.h:30
LibBoard::Rect::topLeft
Point topLeft()
Definition: Rect.h:45
LibBoard::operator&&
Rect operator&&(const Rect &rectA, const Rect &rectB)
Definition: Rect.cpp:37
Point
MyPointD Point
Definition: testClone2.cpp:383
LibBoard::Rect::height
double height
Definition: Rect.h:31