title: Determining the correct origin to rotate a QPolygonF around
body: <p>Edit: Added more information.</p>
  
  <p>I'd like to rotate a <code>QPolygonF</code> around the origin illustrated below:</p>
  
  <p><img src="https://i.stack.imgur.com/PA2y5.png" alt="block rotations"></p>
  
  <p>I'd like this polygon (centre of image is origin - <code>0, 0</code>):</p>
  
  <p><img src="https://i.stack.imgur.com/08ImV.png" alt="first polygon"></p>
  
  <p>To rotate clockwise so that it ends up here:</p>
  
  <p><img src="https://i.stack.imgur.com/r9iXY.png" alt="enter image description here"></p>
  
  <p>The <code>QPolygonF</code> has points in the same position as the first block in the image above:</p>
  
  <pre><code>QPolygonF p1 =  QPolygonF() &lt;&lt; QPointF(0, 1) &lt;&lt; QPointF(4, 1) &lt;&lt; QPointF(4, 2) &lt;&lt; QPointF(0, 2);
  </code></pre>
  
  <p>I then rotate around what I think is the correct origin (<code>2, 2</code>):</p>
  
  <pre><code>QTransform t;
  t.translate(2, 2);
  t.rotate(-90);
  t.translate(-2, -2);
  QPolygonF p2 = t.map(p1);
  qDebug() &lt;&lt; p1 &lt;&lt; "rotated = " &lt;&lt; p2;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>QPolygonF(QPointF(0, 1) QPointF(4, 1) QPointF(4, 2) QPointF(0, 2) ) rotated =  QPolygonF(QPointF(1, 4) QPointF(1, 0) QPointF(2, 0) QPointF(2, 4) )
  </code></pre>
  
  <p>When the output that I want is:</p>
  
  <pre><code>QPolygonF(QPointF(0, 1) QPointF(4, 1) QPointF(4, 2) QPointF(0, 2) ) rotated =  QPolygonF(QPointF(2, 0) QPointF(3, 0) QPointF(3, 4) QPointF(2, 4) )
  </code></pre>
  
  <p>But, according to the output above, the polygon would end up looking like this:</p>
  
  <p><img src="https://i.stack.imgur.com/m9dNy.png" alt="wrong rotation"></p>
  
  <p>At which point should I be rotating around?</p>