mettli / guichan

Automatically exported from code.google.com/p/guichan
Other
0 stars 0 forks source link

Rectangle should not allow negative width and height #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A rectangle with negative width and height doesn't make sense and for 
safety should not be allowed. 

There are two possible solutions:
1. Discard negative input and set it to zero instead.
2. Throw an exception.

Original issue reported on code.google.com by olof.nae...@gmail.com on 3 Sep 2008 at 2:54

GoogleCodeExporter commented 9 years ago
Rather than limiting the actual data structure so rigourously, please consider 
just
adding an isValid() method to the Rectangle class or something. Note that for 
Qt's
QRect, a rectangle isn't valid when width or height are 0 either, which means
QRect::isValid() == !QRect::isEmpty().

Original comment by b.lindeijer on 3 Sep 2008 at 8:06

GoogleCodeExporter commented 9 years ago
I'll add functions for checking if a rectangle is empty or valid instead.

Original comment by olof.nae...@gmail.com on 18 Sep 2008 at 7:42