Boost logo

Boost :

From: michael toksvig (michaeltoksvig_at_[hidden])
Date: 2004-12-21 16:49:50


"Reece Dunn" <msclrhd_at_[hidden]> wrote in message
news:cq90bq$r7v$1_at_sea.gmane.org...
> If you have point high, low; then which corner is "high"? Likewise,
> using top_left, bottom_right is bad. In general, storing a rectangle as
> a set of two points is the wrong representation, especially for
portability.
>
not "high" as in "high on the screen"; "high" as in "value is high", "higher
than low".

maybe "max" and "min" are better names (as in cocoa).

pos x size requires knowledge about the origin, too, doesn't it?

i am assuming that pos+size brings you to the opposite corner of the
rectangle, and also that both components of size are positive for a
non-empty rectangle.

therefore pos represents different corners depending on the origin. and
"a.size += gui::size(10, 20);" will move the top-right corner in e.g. cocoa
and the bottom-right corner in e.g. windows.

ergo no better or worse than 2 points, just different

i'd definitely add operator[] to point and size, though. anywhere you can
write a loop, you don't make a copy-paste error

regards,

michael toksvig


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk