mettli / guichan

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

Rectangle should have a function for checking if the rectangle is valid #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The functions could be named isValid and simply return true if the 
rectangle is valid and false otherwise. An invalid rectangle is a rectangle 
with negative width and height.

Original issue reported on code.google.com by olof.nae...@gmail.com on 15 Sep 2008 at 10:33

GoogleCodeExporter commented 9 years ago
I still find it a bit strange that a "rectangle" with width or height as 0 
would be
valid, since that's not exactly a rectangle. But I may just be biased, I don't 
know
what might be more convenient considering the use-cases (which I don't know).

Original comment by b.lindeijer on 16 Sep 2008 at 11:52

GoogleCodeExporter commented 9 years ago
Depends on: is the border considered to be part of the rectangle? If yes, then 
height 0 would be just a line and thus be a valid rectangle... 

Original comment by tobias.s...@gmx.net on 16 Sep 2008 at 11:58

GoogleCodeExporter commented 9 years ago
Perhaps it simply suffice with the an isEmpty function?

Original comment by olof.nae...@gmail.com on 16 Sep 2008 at 1:04

GoogleCodeExporter commented 9 years ago
Yes, I would say isValid isn't necessary anymore once you have isEmpty. 
Checking the
Java rectangle class it only has the latter too.

Original comment by b.lindeijer on 19 Sep 2008 at 8:04

GoogleCodeExporter commented 9 years ago

Original comment by olof.nae...@gmail.com on 19 Sep 2008 at 1:42