Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using QPainter transform for perspective projection
Qt 6.11 is out! See what's new in the release blog

Using QPainter transform for perspective projection

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 441 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Netzer60315
    wrote on last edited by
    #1

    QPainter draws on a 2D plane and is able to modify its coordinate system by .setTransform() in combination with QTransform.
    The latter has a built-in kind of projection (using a constant distance to plane of 1024), for example used when rotating around the x-axis.
    Is it possible to set the transforms to different z-Values (for each transform) in order to achieve a 3D projection (for example rotating a cube around its center x-axis, viewed from (0, 0,0))?
    In QTransform doc it says: "Perspective transformation is achieved by setting both the projection factors and the scaling factors" [of the transform matrix]. https://doc.qt.io/qt-6/qtransform.html#basic-matrix-operations
    But what would be the math behind that?

    Another solution could be using QMatrix4x4 transformation and the perspective() and toTransform() functions to get a QTransform object. But thats seems even more complicated.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved