[eigen] Re: about Transform API |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: [eigen] Re: about Transform API*From*: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>*Date*: Wed, 27 Aug 2008 13:58:44 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=SFqY1rBqIa+lBUAFmehQDE3BZu7Vwl87D+weP92N0iw=; b=QlqPydxd1OGkLgr84ckn8mQBhKecY6jMVn5Tk5WXC2320ZmGwbpno+3hrM3jt/VMb0 fM+FdZNTI52HwQO8hJ3Ih/Um5OH+9GE4XucL9hKBiuMnp/cv6aZcsSPgG6Ugtkp7eegZ I9E0p8/gw3RVHme6A1I4IT8JlZmu1Nio1lDL8=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=atirS1noRxIEYsukxFwZkcHsYBy6kMGKWCTff2mgc3YBTkRlnOF/bBYYOTwE1I/Op0 QQiWf0ntDuSiW07JtgH+P0+eWsBvLpINDRX+zSJ1myiL5sharRKrVmrsVBUeGi+hYeX9 EDZw11EXsmV8wGFje1tNC37JbSKWIcjAxtcB4=

I forgot to make it clear that I'm not strongly attached to such a change, it is only a suggestion, and I'm fine with the current state !

gael.

On Wed, Aug 27, 2008 at 12:47 PM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

Hi list,

if we still agree that Eigen should be as close as possible to what people would write on a piece of paper, then I think Transform is poorly designed.

For instance if you want to concatenate a scale S to a transformation T you would write:

paper: T' = T * S

or

paper: T' = S * T

while in Eigen we currently have to write:

eigen: T = T.scale(Vector3f(sx,sy,sz));

or

eigen: T = T.prescale(Vector3f(sx,sy,sz));

What about doing something similar to what I did with rotations and overloading the correct *= and * operators such that you could write:

eigen: T = T * Scale3f(sx,sy,sz);

eigen: T *= Scale3f(sx,sy,sz);

or

eigen: T = Scale3f(sx,sy,sz) * T;

then if you want to express:

paper: T = S * R * L;

(where L is a translation)

you could write:

eigen: T = Scale3f(..) * RotationType(....) * Translation3f(...);

(with RotationType in {Quaternion, Matrix, AngleAxis, Rotation2D } )

instead of the current:

eigen: T.setIdentity();

eigen: T.scale(...);

eigen: T.rotate(...);

eigen: T.translate(...);

ok, actually the rotate, scale and translate methods return a reference to T, so currently you can still write:

eigen: T.setIdentity();

eigen: T.scale(...).rotate(...).translate(...);

that is not too bad in that case, but think about "T = R1 * L * T * R2" which involves "pre*" versions of the methods:

eigen: T.pretranslate(L).prerotate(R1).rotate(R2);

IMHO it's quite confusing because it does not give you the idea of the transformation order: "R1 * L * T * R2".

From a practical point of view we alrealy have all the RotationType, and we only need to overload the operators as well as to define two wrapper classes Scale and Translate. I'm only a bit scared about a amount of combinations to handle... though all products involving two different transformation types will generate a Transform, so that's certainely doable.

Also, perhaps we can keep both API ?

that's all folk, what do you think ?

gael.

**References**:**[eigen] about Transform API***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] about Transform API** - Next by Date:
**Re: [eigen] about Transform API** - Previous by thread:
**[eigen] about Transform API** - Next by thread:
**Re: [eigen] about Transform API**

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