[cairo] [patch] enable projective transformations

Arjen Nienhuis a.g.nienhuis at gmail.com
Tue Aug 17 03:04:28 PDT 2010

On Tue, Aug 17, 2010 at 7:27 AM, Andrea Canciani <ranma42 at gmail.com> wrote:
> On Tue, Aug 17, 2010 at 1:24 AM, Bill Spitzak <spitzak at gmail.com> wrote:
>> Maarten Bosmans wrote:
>>> This is a first attempt to add projective transformations to Cairo. It
>>> is far from complete, but mostly meant to get the discussion going
>>> about how such a feature should be implemented.
>> I believe if you want to concatenate transforms you need to keep 12 numbers
>> (a 4x3 matrix) around. Otherwise not enough information is remembered so
>> that two "rotate about the y axis by 10 degrees" can produce the same result
>> as one "rotate about the y axis by 20 degrees". The 8 number cannot
>> distinguish such a rotation from a horizontal scale by 1-sin(10 degrees).
> A 2D projective transform is 3x3 (it is a linear transform in the
> associated homogeneous space), so requires only 9 elements.
> Or are you suggesting that using 3D transformations would be better?
> Do you have any use case (where 2D projective transform would not be
> enough and 3D would be needed)?

It could work the same as current matrix transforms in cairo in 2D:

translate(0, 10)
translate(0, -10)

Could be used in 3d as:

translate3d(0, 10, 0)
rotate3d(r, 0, 0)
translate3d(0, -10, 0)

I think you need the full 4 * 3 matrix for that.

More information about the cairo mailing list