Results 1 to 4 of 4

Thread: QTransform for walls

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTransform for walls



    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

    Qt Code:
    1. QTransform trans;
    2. trans.translate(1000, 500);
    3. trans.rotate(25, Qt::XAxis);
    4. trans.rotate(-10, Qt::ZAxis);
    5.  
    6. QPixmap tile("tile.jpg");
    7. QPixmap p(1920, 1080);
    8. QPainter pp(&p);
    9. pp.setTransform(trans);
    10. pp.drawTiledPixmap(QRect(-1000, -1000, 3000, 3000), tile);
    11. p.save("room.jpg")
    To copy to clipboard, switch view to plain text mode 

    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/p...ormations.html to understand these rools but I just can't find any information about my problem, I mean deep understanding of combination for QTransform.
    Attached Images Attached Images

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: QTransform for walls

    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.

  3. #3
    Join Date
    Mar 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTransform for walls

    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...

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QTransform for walls

    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.

Similar Threads

  1. How to construct a QTransform?
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2011, 15:20
  2. Using QTransform to map the mouse
    By Cruz in forum Qt Programming
    Replies: 0
    Last Post: 22nd February 2010, 08:47
  3. QTransform()
    By mkind in forum Newbie
    Replies: 0
    Last Post: 19th February 2010, 21:45
  4. GraphicsItemChange and QTransform
    By ct-xuyaojun in forum Qt Programming
    Replies: 0
    Last Post: 28th September 2009, 09:16
  5. QTransform vs QMatrix
    By maverick_pol in forum Qt Programming
    Replies: 7
    Last Post: 4th October 2007, 10:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.