[cairo] Adding cairo_shear and family

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Mon Jan 12 13:52:49 PST 2009


On Mon, 12 Jan 2009, Behdad Esfahbod wrote:

> The docs should say "for a shear in the X direction, use sy=0, for a shear in
> the Y direction, use sx=0".

Sure.

> I'm not advertising use of matrix notation, just document what the xx,
> xy, yx, yy, x0, and y0 values of the transform matrix for a shear are.

Agreed.

[snip the proposal of a cairo_shear(angle, scale)]

> Nah.  Why not have cairo_scale take an angle too?  Really. 
> [...] It doesn't preserve area.  So what? Neither does 
> cairo_scale!

cairo_scale() actually scales stuff. ;)

FWIW, I liked Bill's and Paolo's approach of an area preserving 
mapping (this being one of the properties of a shear) and along 
those lines I would propose using

[1 +- sqrt(-sx*sy)	sx
sy			1 -+ sqrt(-sx*sy)],

except it's just the (angle, scale) thing put another way.  This 
is a general form for shears along some vector in the sense that 
there's some orthogonal basis in which it is a transvection along 
a coordinate axis.

We'll just have to agree to disagree. :)

Cheers,

Joonas


More information about the cairo mailing list