[Development] matrix math help needed - https://bugreports.qt.io/browse/QTBUG-84441
edward.welbourne at qt.io
Wed May 27 10:34:45 CEST 2020
Matthew Woehlke (26 May 2020 18:15)
> The documentation is not clear if the scale, rotate, etc. methods of
> QTransform apply *before* or *after* whatever the QTransform is already
> doing. The bug report indicates that they are applied *first*.
> Given the potential for breaking existing code which expects the current
> behavior, my inclination would be to clarify the documentation to
> clearly state the existing behavior.
Yes, the docs do need updated; they do correctly say what QTransform does,
but that behaviour managed to confuse me for a while, too.
> (Note: I didn't actually test this myself or look at the code, I am just
> going off of what the bug report says. In any case, however, the
> documentation should be fixed.)
Indeed. I did test this myself, and was surprised that
double a = qDegreesToRadians(45.0);
double sina = qSin(a);
double cosa = qCos(a);
QCOMPARE(QTransform().translate(50, 50).rotate(45).scale(0.5, 1.0),
QTransform(0.5, 0, 0, 1.0, 0, 0)
* QTransform(cosa, sina, -sina, cosa, 0, 0)
* QTransform(1, 0, 0, 1, 50.0, 50.0));
passes. However, once it did, I knew what was going on ...
More information about the Development