3 from affine import Affine
4 from math import sin, cos, radians
14 # Some transform to compose
15 T1 = Affine.translation(-src_x, -src_y)
16 R = Affine.rotation(angle)
17 T2 = Affine.translation(dest_x, dest_y)
19 # Composition is performed by multiplying from right to left
21 print [item for item in matrix]
23 theta = radians(angle)
25 # This is the equivalent transformation matrix
27 cos(theta), -sin(theta), -src_x * cos(theta) + src_y * sin(theta) + dest_x,
28 sin(theta), cos(theta), -src_x * sin(theta) - src_y * cos(theta) + dest_y,