DGtal 1.3.0
Loading...
Searching...
No Matches
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
20namespace LibBoard {
21
26struct 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
59Rect operator||( const Rect & rectA, const Rect & rectB );
60
69Rect operator&&( const Rect & rectA, const Rect & rectB );
70
71
72} // mamespace BoardLib
73
82std::ostream & operator<<( std::ostream & out, const LibBoard::Rect & rect );
83
84#endif // _RECT_H_
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Rect operator&&(const Rect &rectA, const Rect &rectB)
Definition: Rect.cpp:37
Rect operator||(const Rect &rectA, const Rect &rectB)
Definition: Rect.cpp:20
Struct representing a 2D point.
Definition: Point.h:27
Struct representing a rectangle on the plane.
Definition: Rect.h:26
Point bottomLeft()
Definition: Rect.h:47
Point bottomRight()
Definition: Rect.h:48
Rect(double leftX=0.0f, double topY=0.0f, double rectWidth=0.0f, double rectHeight=0.0f)
Definition: Rect.h:42
Point topRight()
Definition: Rect.h:46
double height
Definition: Rect.h:31
Point topLeft()
Definition: Rect.h:45
double width
Definition: Rect.h:30
double left
Definition: Rect.h:28
double top
Definition: Rect.h:29