|
Boost : |
From: Val Samko (boost_at_[hidden])
Date: 2004-11-05 18:54:30
RD> MFC gets the intended use of CPoint/CSize wrong.
RD> In a mathematical sense, a point is a 0-size location in an nD
RD> coordinate system. In this case, it is a 2D coordinate system, so is
RD> (x,y). This is used for positioning, e.g. moving the graphics cursor, so
RD> I call it gui::position. It does not make sense to perform point [+-*/]=
RD> point since points are locations in a space (how do I add the location
RD> of my house to the location of Jupiter)?
I do not follow your logic. In mathematics, in Cartesian nD coordinate
system, a point is represented by a set of distances between that
point and the centre of coordinates, along each axe. Just like a vector.
And vectorA + vectorB is a very common operation.
RD> The size type stores width and height information, so it can be treated
RD> as a 2D vector. In this case, standard arithmetic operations make sense.
RD> Also, it is possible for sizes to interact with points, e.g. point += size.
Once again, in geometry, vector and point are practically the same thing.
RD> If you do point - point, then the resulting type is a size type that
RD> represents the distance between the two points.
Just like size - size.
RD> So in a mathematical sense, the difference between size and position is
RD> entirely relevant, it's just that some libraries (not mentioning names)
RD> do not adhere to the above mathematical rules.
There are no mathematical rules, which say that a point in nD
Cartesian coordinate system is not just a set of corresponding
distances along each axe.
Valentin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk