PDA

View Full Version : QTransform for walls



daorus
1st August 2011, 20:47
http://www.qtcentre.org/attachment.php?attachmentid=6727&d=1312224010

For about a week I spent to figure out rules to get right combination of translate and axis rotation to build a tranform object to set to painter in the following way


QTransform trans;
trans.translate(1000, 500);
trans.rotate(25, Qt::XAxis);
trans.rotate(-10, Qt::ZAxis);

QPixmap tile("tile.jpg");
QPixmap p(1920, 1080);
QPainter pp(&p);
pp.setTransform(trans);
pp.drawTiledPixmap(QRect(-1000, -1000, 3000, 3000), tile);
p.save("room.jpg")

Does anybody can recommend the rules how to get definitelly that turn I want, no matter how crazy it is?

If life is a fairy tale I WOULD want to get a utily like this http://zrusin.blogspot.com/2006/09/perspective-transformations.html to understand these rools but I just can't find any information about my problem, I mean deep understanding of combination for QTransform.

mvuori
2nd August 2011, 19:39
Nobody seems to know -- apparently you need to start some hard core studying of geometry.

Actually, I recall wondering about the mysteries of the transformations myself, but couldn't find any documentation either.

daorus
2nd August 2011, 22:28
I do not understand why there is no any tutorial or article on this, cause I do belive it's quite simple task to turn walls...

SixDegrees
3rd August 2011, 00:25
You can't do 3D transformations with a 2D transformation matrix.

You'll need to read up on matrix transformations, affine transforms and projections, and augmented matrices.