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. get new point coordinates on a rect after applying transformation
Forum Updated to NodeBB v4.3 + New Features

get new point coordinates on a rect after applying transformation

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 438 Views 2 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.
  • DonCoderD Offline
    DonCoderD Offline
    DonCoder
    wrote on last edited by
    #1

    I rotated a rect to 90 on its center. P is point on initial rect,
    QPoint P(x,y);

    qreal angle = ...;
    QRect rect = ...;
    Qpoint center = rect.center();
    QTransform t = QTransform().translate( center.x(), center-y() ).rotate( angle ).translate( -center.x(), -center.y() );
    Qrect rotatedRect = t.mapToRect( rect );

    Now how to get new coordinated of P on rotatedRect ?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      QPoint rotatedP = t.map(P);

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2

      • Login

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