The coordinates are often transformed with the use of a matrix. The matrix is similar to a transformation matrix in Postscript. It includes a set of scaling factors, rotation angles and translations.
When only the scaling factors are used (no rotation) then these are ratios as one would expect. If a rotation is also applied, then the scaling ratios will be affected accordingly.
The translations are in TWIPS like any coordinates and also they are applied last (thus, it represents the position at which the shape is drawn on the output screen).
The math formula is as simple as: Q = MP + T. Q is the resulting point, P is the source point, M is the scaling and rotation factors and T is the final translation.
With the use of a three dimensional set of matrices, one can compute a single matrix which includes all the transformations.

Thus, the matrix saved in the SWF file is the product of the matrix in figure 2 and the matrix in figure 5.
A matrix multiplication is the sum of the products of rows (left matrix) and columns (right matrix).
m_{11} = s_{11} * r_{11} + s_{12} * r_{21} + s_{13} * r_{31} + s_{14} * r_{41} m_{12} = s_{21} * r_{11} + s_{22} * r_{21} + s_{23} * r_{31} + s_{24} * r_{41} m_{13} = s_{31} * r_{11} + s_{32} * r_{21} + s_{33} * r_{31} + s_{34} * r_{41} m_{14} = s_{41} * r_{11} + s_{42} * r_{21} + s_{43} * r_{31} + s_{44} * r_{41} m_{21} = s_{11} * r_{12} + s_{12} * r_{22} + s_{13} * r_{32} + s_{14} * r_{42} m_{22} = s_{21} * r_{12} + s_{22} * r_{22} + s_{23} * r_{32} + s_{24} * r_{42} m_{23} = s_{31} * r_{12} + s_{32} * r_{22} + s_{33} * r_{32} + s_{34} * r_{42} m_{24} = s_{41} * r_{12} + s_{42} * r_{22} + s_{43} * r_{32} + s_{44} * r_{42} m_{31} = s_{11} * r_{13} + s_{12} * r_{23} + s_{13} * r_{33} + s_{14} * r_{43} m_{32} = s_{21} * r_{13} + s_{22} * r_{23} + s_{23} * r_{33} + s_{24} * r_{43} m_{33} = s_{31} * r_{13} + s_{32} * r_{23} + s_{33} * r_{33} + s_{34} * r_{43} m_{34} = s_{41} * r_{13} + s_{42} * r_{23} + s_{43} * r_{33} + s_{44} * r_{43} m_{41} = s_{11} * r_{14} + s_{12} * r_{24} + s_{13} * r_{34} + s_{14} * r_{44} m_{42} = s_{21} * r_{14} + s_{22} * r_{24} + s_{23} * r_{34} + s_{24} * r_{44} m_{43} = s_{31} * r_{14} + s_{32} * r_{24} + s_{33} * r_{34} + s_{34} * r_{44} m_{44} = s_{41} * r_{14} + s_{42} * r_{24} + s_{43} * r_{34} + s_{44} * r_{44}
Though you shouldn't need to find the scaling factors and rotation angle from an SWF matrix, it is possible to find one if you know the other. This is done using a multiplication of either the inverse scaling (use: 1/S_{x}
and 1/S_{y}
instead of S_{x}
and S_{y}
for the scaling matrix) or the inverse rotation (use: angle
instead of angle
in the Z rotation matrix).
For those who still wonder what I'm talking about, there are the four computations you need from a scaling factor and an angle in radiant:
SWFmatrix_{11} = S_{x} * cos(angle) SWFmatrix_{12} = S_{y} * sin(angle) SWFmatrix_{21} = S_{x} * sin(angle) SWFmatrix_{22} = S_{y} * cos(angle)
SWFmatrix_{11}
and SWFmatrix_{22}
are saved in the (x, y) scale respectively and the SWFmatrix_{21}
and SWFmatrix_{12}
are the rotation skew0 and skew1 values respectively.