[cairo] Extracting The Scaling Component Of A Matrix

Behdad Esfahbod behdad.esfahbod at gmail.com
Sat Dec 12 03:15:17 PST 2015


On 15-12-11 01:51 AM, Lawrence D'Oliveiro wrote:
> I construct a matrix that implements just the scaling component of the
> CTM in the Cairo context “ctx”:
> 
>     scaling = Matrix.scale(ctx.user_to_device_distance(Vector(1, 1)))

This wouldn't do what you think it does for general matrices.  Or maybe I
don't understand what you are trying to do.  Are you only interested in
non-skewed matrices?

> This can be easily adapted to extracting the scaling component of a
> given matrix “mat”:
> 
>     scaling = Matrix.scale(mat.mapdelta(Vector(1, 1)))
> 
> Exercise: can you come up with a similarly simple expression for
> extracting the angle of the rotation component of a matrix?
> 


More information about the cairo mailing list