Re: [eigen] about Transform API |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] about Transform API*From*: "Thomas Vaughan" <tevaughan@xxxxxxxxx>*Date*: Wed, 27 Aug 2008 08:42:15 -0600*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 :content-transfer-encoding:content-disposition:references; bh=U6d8iQlrKUiSE4WTTP0d1sUbE2M79y8Z4PC7WPgtzPc=; b=AtU/G2nD8KqiXRACYxep2zkamuHc9u2tSh0dBkj/famm9jOM2gyLKLvkoHvtcbn8zP AO/Z4mA7FCnw+g1Jx9F7Tw9d3MD1Y/BbkBpBG0SHNbKEdu51C9WmwXFQMhbmkXe3slRU MLGJrhZPqReR/TlzxM1ZKfq53IsppX/ybFrAA=*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:content-transfer-encoding:content-disposition :references; b=qvCwlurq8yjKJFkBpMPZ9LdOD+B89OFZBO4wlq5eweZZ+/93Ni8gwdpmhIwPVnMN8g YMBSHW7XifNtm7svU6dKZDXZqMC0H9Zfimyy5lLCE2MLWoczwD/zjrJq+HIrBp75sKEO eY4uovBLbokEcR+lNtMKMPNjbw3l4hnMy5gTU=

On Wed, Aug 27, 2008 at 4:47 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote: > > 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)); I've not yet used scaling in eigen. I presume that the Vector is used to initialize a diagonal matrix that is multiplied in (or perhaps you use a more efficient algorithm to scale the transform). > 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; Presumably, Scale3f(sx,sy,sz) would construct a 3x3 diagonal matrix. The scale constructor above seems much prettier to me than initializing with a Vector, but I suppose that you would need a Vector initialization of Scale for the arbitrary NxN case. (As you have probably noticed, I prefer to instantiate a Vector only if it is really a vector. :^) > 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 } ) So Translation3f() constructs a 4x4, and the first multiplication (between the Scale and the Rotation) is between a pair of 3x3s, right? > 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); Yuck. > IMHO it's quite confusing because it does not give you the idea of the > transformation order: "R1 * L * T * R2". Right. > Also, perhaps we can keep both API ? Why not? > that's all folk, what do you think ? I think that it is a beautiful idea, at least in terms of the API. -- Thomas E. Vaughan There are only two kinds of people; those who accept dogma and know it, and those who accept dogma and don't know it. - G.K. Chesterton

**Follow-Ups**:**Re: [eigen] about Transform API***From:*Gael Guennebaud

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

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

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