Boost :

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

"Deane Yang" <deane_yang_at_[hidden]> wrote
> Deane Yang 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.
>>
>
> Now, to contradict myself, it is useful to rescale and add points in at least
> one circumstance: when you want the "center of mass" or the "average" of a set
> of points A1,..., An. In principle, you can do it as
>
> B + [(A1-B) + .... + (An - B)]/n
>
> but that's a lot of extra subtractions.

IMO there are a large number of cases eg when interpolating positions on a
curve/surface where multiplication and addition is necessary.

> If I needed this (or a weighted average), I would probably encapsulate it in a
> weighted average function (which would internally rescale and add the points)
> and still disallow rescaling and adding points in my library interface.
>
> But I guess I now see why someone might just find it more convenient to allow
> rescaling and adding points.

Thanks for that :-)
I do feel that it is necessary to get the basics thrashed out as they are the
simplest building blocks of a graphics system.

regards
Andy Little