title: CGAffineTransform concatenation: appropriate order of transformations
body: <p>I know that whenever we want to apply a series of transform at once to a point, we have to specify the sequence in the opposite direction to what we want to perceive. If I want to translate(<strong>T</strong>) and then rotate(<strong>R</strong>) a point <strong>x</strong> we  need to end with a concatenation matrix <strong>RT</strong>, then every point is transformed as <strong>(RT)x</strong>.</p>
  
  <p><a href="https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_affine/dq_affine.html" rel="nofollow noreferrer">Apple Transform</a> documentation shows that CGAffineTransform work as a transpose version of the above expression. i.e instead of transform a points as <strong>Ax</strong> for <strong>A</strong> being any transform matrix they do it as <strong>xB</strong> for <strong>B</strong> being the transpose of <strong>A</strong>.</p>
  
  <p>Also <a href="https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_affine/dq_affine.html" rel="nofollow noreferrer">CGAffineTransform.concatenating(T2)</a> documentation state that it stack transforms to the right, ending in an transform matrix of the form as <strong>T1 * T2</strong>.</p>
  
  <p>Now what are my concerns? If want a series of transformation that <code>translate</code>(<strong>T</strong>) and then <code>rotate</code>(<strong>R</strong>), I can call <code>T.concatenating(R)</code> which result in a transform <strong>TR</strong>, then the points are transformed as <strong>xTR</strong>, it seem that the order must be respected, but actually I'm getting the wrong result(<em>at least that's what i think</em>), I expect the image A but getting B, </p>
  
  <p><a href="https://i.stack.imgur.com/DnE2L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DnE2L.png" alt="enter image description here"></a></p>
  
  <p>It seem that they are transforming points as <strong>TRx</strong>, but this contradict the documentation and also not match the result when you apply the transform <strong>TR</strong> to a point as <a href="https://developer.apple.com/documentation/coregraphics/cgpoint/1454251-applying" rel="nofollow noreferrer">CGPoint.applying(TR)</a> which also is consistent with the order <strong>xTR</strong>.</p>
  
  <p>why's that? there's something that I'm missing about how transforms works in iOS?</p>