Re: [eigen] Eigen appears to rock.

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On Fri, Aug 22, 2008 at 3:18 PM, Konstantin Heil
<konst.heil@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi!
>
> On Friday 22 August 2008 15:09:54 Gael Guennebaud wrote:
>> For instance, if I want the mid point m of two Points p1 and p2:
>> Point m = 0.5*(p1+p2);
>> would have to be written:
>> Point m = 0.5 * ((p1-Point::Zero()) + (p2-Point::Zero())) + Point::Zero();
>> which version is more confusing ?
>
> Wow, this is very complicate. What's about
> Point m = p1+0.5*(p2-p1);
> This fits to the geometric immagination. Start on p1 and walk 0.5 the way from
> p2 to p1. :)

why not, but what about more general weighted mean of a set of points:

for(i) {
  m += p[i] * weight[i];
  sumW += weight[i];
}
m /= sumW;

cheers
gael.

> I wish you nice day.
> --
> Konstantin (kostja) Heil    <><
> konst.heil@xxxxxxxxxxxxxxxxxxxxxx
> http://kostja.selfip.org
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/