[Development] matrix math help needed - https://bugreports.qt.io/browse/QTBUG-84441
giuseppe.dangelo at kdab.com
Wed May 27 17:09:19 CEST 2020
On 5/27/20 3:58 PM, Matthew Woehlke wrote:
> *Nothing* there clearly states, at least to my reading, whether the
> "new" transform happens*before* or*after* any existing transforms that
> the QTransform is already doing.
> IMO, changing this to clarify that would help significantly.
Sure, augmenting the docs would help. But <devil's advocate> the whole
point of the API is for its usage to be straightforward. If you do
> QTransform t;
> auto result = t.map(foo);
the "obvious" meaning should be that foo is getting first translated,
then rotated, then scaled; not the other way around.
If this is achieved by pre or postmultiplication of (transposed)
matrices matters only if you're into Algebra&Geometry™ -- i.e. poking
into the actual matrix, or if you're combining two transforms by means
of operator*. Otherwise, it is not interesting at all in 99% of the
cases, where you'd just set the transform on a painter or an item similar.
If you really want to use the "low levels", please also note that
operator* is helping you:
> QTransform t1, t2;
> QTransform t = t1 * t2; // ok...
> auto result = foo * t; // can only premultiply!
> // operator*(t, foo) does not exist
So you've built foo * t1 * t2, with t1 applied first. (This in turn
should reveal how QTransform works internally.)
My 2 c,
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4329 bytes
Desc: S/MIME Cryptographic Signature
More information about the Development