gnash-dev
[Top][All Lists]

## [Gnash-dev] canonical form for affine transformations

 From: Eric Hughes Subject: [Gnash-dev] canonical form for affine transformations Date: Sun, 15 Apr 2007 20:42:39 -0600

Sandro's question about matrices last week, and a note I saw about possibly implementing "skew" (really called shear) in the commit log, led me to find some relevant reference information.

The transformation that's implemented in matrix.cpp:
http://en.wikipedia.org/wiki/Affine_transformation

Details about what a matrix representation of the above looks like:
http://en.wikipedia.org/wiki/Transformation_matrix

As for a canonical form, I'd recommend
rotate * x-shear * scale
which in matrix form is, in LaTeX form:
$\left[\begin{matrix} \cos \theta & - \sin \theta \cr \sin \theta & \cos \theta \end{matrix}\right] \left[\begin{matrix} 1 & k \cr 0 & 1 \end{matrix}\right] \left[\begin{matrix} s_x & 0 \cr 0 & s_y \end{matrix}\right]$


In the above, $\theta$ is the angle of rotation, $k$ is the shear value, and $s_x$ and $s_y$ are the scale values.


The reason for this choice is that, since these transformations are naturally applied to type, with its natural baseline along the x-direction, that x-shear is the natural cognitive choice. Putting it after (to the left of) the scaling means that the angle of shear will be independent of the size of the scale factors; otherwise the shear would also be scaled.

Eric