Instead of rotating the shape around its center point, rotate and then translate the canvas. To rotate the shape around the center of the figure (x, y) , first translate the canvas to (-x, -y) , and then rotate the canvas -d degrees and draw the shape as usual on (0,0).
When you are done, turn back and then translate back (note that with these geometric transformations, order is important, translation and then rotation will give you a completely different result).
This means that you can still draw an object at any turn without having to recalculate the coordinates yourself.
source share