Rotation matrices can only describe rotations around (0, 0), so you have to use translation.
EDIT See this JSFiddle . It draws a rectangle defined with an offset, width, and height rotated around a pivot point. The interesting part is the last 10 lines or so, where the values ββfor offsetX and offsetY are calculated. After that, you can build your translation and your rotation matrices. Then just multiply the translation by rotation, and you get the final result. Unfortunately, Javascript does not offer any matrix functionality, so if you do not provide your code, this is all I can do
HOW THE TRANSFER MATRIX IS MADE
1 0 offsetX 0 1 offsetY 0 0 1
HOW DOES THE ROTATION MATRIX
cos -sin 0 sin cos 0 0 0 1

Raffaele
source share