Search code examples
matrixcocos2d-iphonepointmatrix-multiplicationcgpoint

cocos2d. Matrix calculations?


I draw a graphical primitives using functions ccDraw... and I need to calc for example a scale and transition using 3x3 matrices.

How to solve this issue in cocos2d? I can't simply use sprites/nodes because all the calculated points belong to the same object. Is it possible without converting CGPoint->matrix->CGPoint?


Solution

  • It sounds like you are trying to do scale/rotation on the CGPoints. You can do this using CGAffineTransform functions and structure that are part of Quartz 2D.

    See these references:

    1. Apple's Documents.
    2. A single example of rotating a rectangle formed by four points.
    3. SO Example(s).

    Was this helpful?