Boost logo

Boost :

From: Deane Yang (deane_yang_at_[hidden])
Date: 2005-06-02 13:18:52


Andy Little wrote:
>
> Ideally the two expressions should be equivalent:
>
> 2/3 *A +1/3 * B == A + (1/3)*(B - A) = (2 * A + B ) / 3 etc
>
> If no multiplication or addition is allowed on points, this is not the
> case. (Welll.. its possible to work it at compile time, but I believe
> this is too restrictive) The points implementation is getting in the way
> of the expression. Expressions will fail for no good reason. OTOH These
> calculations work correctly if A and B are 'position-vectors'.
>

What is the difference between a "point" and a "position-vector"?

Unfortunately, it appears that everyone uses similar words but with
different specific meanings.

For me, a "point" is an element in n-dimensional flat affine space. A
"vector" is an element in the associated n-dimensional vector space
(sometimes called the "tangent space"). So the allowable operations are
the standard vector space operations for vectors (vector addition and
scalar multiplication) plus

point + vector -> point

This should be enough to do any computation that anybody would ever
need. And, unless computational speed is a real issue, I think it's much
clearer to always code one's computations in this form. In my mind, the
meaning of

A + (1/3)*(B-A) ("start at A and go 1/3 the distance towards B")

is much more transparent than

(2/3)A + (1/3)B ("rescale A by 2/3; rescale B by 1/3; add")

However, I do acknowledge that for intensive computations you might not
want to constrain yourself in this way.


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