Boost logo

Boost :

From: Andreas Harnack (ah.boost.04_at_[hidden])
Date: 2007-03-07 07:33:32


Tom Brinkman schrieb:
> Just in case any one is curious, a euclidean vector is represented by its
> Cartesian coordinates: (*p*0, *p*1,..., *p*d - 1) (in a d-dimensional
> vectorial space).
[Snip]
> However, an euclidean
> vector is very different from a point, or location, (from a mathematical
> point of view) and it would have been confusing to represent these two
> entities by the same *concept*.

Thanks for the feedback. Yes, at the end of the day we're talking about
Cartesian products here. The naming is rather ad hoc and certainly needs
to be tune. I'm particular uncomfortable with the current use of the
term dimension. It is actually a quantity in terms of dimensional
analysis, an what DA calls a dimension is here just an unsigned integer.
So, thinking about it, using the names

cartesian::coord;
cartesian::point;

rather then dimensions and vectors might not be a bad choice either; The
name space would make clear that other representations like polar
coordinates are not included.

On the other hand, a point is not a very interesting object. For
example, can points be added or multiplied with a scalar? Strictly
speaking, that makes sense only for distances, i.e. vectors.

You're right, there is a difference between points and vectors. A point,
for example, has a dimension of zero, while a vector has always a
dimension of one, regardless what the dimension of the vector space is.
(So when talking about a three-dimensional vector, we're actually
talking about a one-dimensional object in a three-dimensional space.)
But this distinction is hardly ever made in mathematics, unless in
introductions and maybe in very special discussions. Typically a point
and it's position vector are treated synonymously, so I wonder if we
really need to make the distinction here? We could cleanly separate both
concepts, like:

namespace cartesian
{
         template<typename T, unsigned int D> coord; // was dim
         template<typename T, unsigned int D> point; // was vec
         // point now without vector operations
};

namespace euclid
{
         template<typename T, unsigned int D> vector
         {
                         cartesian::point<T,D> point;
                 public:
                         // vector operations go in here
         };
};

maybe with implicit conversion between points and vectors. Looks
charming but a bit like an overkill to me. What do you think?

Best regards,
Andreas


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