[eigen] about Transform API |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] about Transform API
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 27 Aug 2008 12:47:31 +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:mime-version:content-type; bh=kb/k8xwhxM0LyFqT0yp+2I4vnWPTMa+BIe6kft7eu60=; b=L/CxbaCQOrvvvBCaZ1yDaCe8J8g5MGuLtf7g1nQNSLF+t05vYA3552tHWRQt8ttWIs ANEkdwXpa1O/ny/GF1HqlkvI5V9LmEPnba+Tsm44j2ze9ziQ2wvMSUiVEUIZq24xDIoR PNr646U5NCF6eJtLAaMQmY144JUXvmpkdXQyI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=qGnhik3ALXDFyjomxOoXlsXO050JLXMG6ImxxBnXioe/MvN/5wuUwQ+LGDRnYGEV8d zpAotqyr14wGR/Wd6HGrhI7rzFcDDUBLh/dN93PMbJi+9VHaiTlwWZx2/n6pKliQPMFr IKZ56EM9TpLNATxgh6hgpFZVqVFAZD6g5ohIA=
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".