initializing Rectangle (NAR??)

  • Thread starter Thread starter woodBeeProgrammer
  • Start date Start date
W

woodBeeProgrammer

is there a conventional way to initialize rectangles to
an invalid value, sort of like NAN for doubles?
 
I don't know that this is possible. After all, I don't know that there
is a valid "invalid" value for a Rectangle structure. The structure itself
has all of its members as integers, so you can't really assign NaN to any of
the members. If anything, I would have an encapsulating structure with a
flag indicating whether or not it was initialized.

Hope this helps.
 
I don't know that this is possible. After all, I don't know that there
is a valid "invalid" value for a Rectangle structure. The structure itself
has all of its members as integers, so you can't really assign NaN to any of
the members. If anything, I would have an encapsulating structure with a
flag indicating whether or not it was initialized.

You can certainly describe a rectangle that doesn't make any sense
and that would do. If an "invalid" or NAR is defined as one
whose Left is > that its Right or whose Top is > than its Bottom
(assuming standard screen coordinates) then that would do.

It would also have the advantage of being type compatable and
assignable to "valid" Rectangles, a feature one would have to
give up if one defined an enclosing structure.

A static function that tests for NAR's would be trivally written.

Oz
 
Back
Top