13 RectD(const PointD
&topLeft
, const PointD
&bottomRight
)
14 : _tl(topLeft
), _br(bottomRight
) {}
15 RectD(const RectC
&rect
, const Projection
&proj
, int samples
= 100);
17 PointD
topLeft() const {return _tl
;}
18 PointD
bottomRight() const {return _br
;}
20 {return PointD((_tl
.x() + _br
.x()) / 2.0,
21 (_tl
.y() + _br
.y()) / 2.0);}
23 double left() const {return _tl
.x();}
24 double right() const {return _br
.x();}
25 double top() const {return _tl
.y();}
26 double bottom() const {return _br
.y();}
28 void setLeft(double val
) {_tl
.rx() = val
;}
29 void setRight(double val
) {_br
.rx() = val
;}
30 void setTop(double val
) {_tl
.ry() = val
;}
31 void setBottom(double val
) {_br
.ry() = val
;}
33 double width() const {return (right() - left());}
34 double height() const {return (top() - bottom());}
36 bool contains(const PointD
&p
) const
37 {return (p
.x() >= left() && p
.x() <= right() && p
.y() <= top()
38 && p
.y() >= bottom());}
40 bool isNull() const {return _tl
.isNull() && _br
.isNull();}
42 {return (_tl
.isValid() && _br
.isValid()
43 && _tl
.x() != _br
.x() && _tl
.y() != _br
.y());}
45 RectC
toRectC(const Projection
&proj
, int samples
= 100) const;
52 inline QDebug
operator<<(QDebug dbg
, const RectD
&rect
)
54 dbg
.nospace() << "RectD(" << rect
.topLeft() << ", " << rect
.bottomRight()