This is mostly for the programmers in the audience.
In the VectorStorm library, I have a “box” class which represents a 2D or 3D box. Currently, you initialise one of these by specifying the positions of two opposite corners.
For a long while, I’ve been thinking about adding the ability to just set the width and height of the box, rather than needing to explicitly set the corner positions. This would be a whole lot more convenient for many uses.
The question is about expected behaviour. If you wrote this code:
Would you expect myBox’s horizontal corners to be at 0 and 100, or at -50 and 50? (That is, should the box start at (0,0), or should it be centered on (0,0)?)
Anybody have thoughts? I’m having real trouble deciding what the behaviour should be when specifying a box by its dimensions, instead of by its corner positions. Maybe I should just avoid this question entirely by making people explicitly set the corners, and not allowing them to set the dimensions directly.