[cairo] Extracting The Scaling Component Of A Matrix

Arjen Nienhuis a.g.nienhuis at gmail.com
Mon Dec 14 13:30:26 PST 2015


> Yeah... You have to define what exactly you want.  A 2D matrix like the ones
> cairo uses can always be decomposed into a concatenation of the following
> matrices:
>
>   - transform

transform is what cairo calls translate right?

>   - rotate
>   - skew
>   - scale
>
> This has many useful properties, and you can derive those four transformations
> from an arbitrary matrix easily.  Here's my derivation:
>
> https://readable-email.org/list/www-style/topic/better-matrix-decomposition-for-animation
>
> This also describes the benefits of such decompositions:
>
> http://research.cs.wisc.edu/graphics/Courses/838-s2002/Papers/polar-decomp.pdf
>
> If you transform a circle with a matrix, you get an ellipse.  If you are
> interested in the major and minor axes of that ellipse, that's a Singular
> Value Decomposition of the 2D matrix.  I've put code here for doing that:
>
> https://github.com/behdad/cairo/blob/color-emoji/doc/tutorial/src/singular.c
>
> Cheers,
>
> behdad
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list