Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-06-02 12:36:42


"Deane Yang" <deane_yang_at_[hidden]> wrote
> Andy Little wrote:
>>
>> eg to find the point 1/3 rd way from the start of line(A , B) one could
>> calculate 2/3 *A +1/3 * B.
>>
>
> I think it is more natural to compute this as
>
> A + (1/3)*(B - A),
>
> where A and B are points and B - A is a vector. So you're really still just
> adding a vector to a point to get a new point. There is never a need to add or
> rescale points.

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'.

regards
Andy Little


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