[cairo] [patch] enable projective transformations

Bill Spitzak spitzak at gmail.com
Tue Aug 17 11:08:14 PDT 2010


On 08/16/2010 10:27 PM, Andrea Canciani wrote:

> 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)?

A 3x3 matrix cannot do translations. This is the same reason 2-D cairo 
cannot use a 2x2 matrix.

I think the confusion is that a 3x3 matrix *can* be used to translate 
[x,y,1] into [x*w,y*w,w] and thus can go directly from any shape on a 
plane to it's perspective projection on the screen. But this matrix has 
insufficient information and does not do anything useful for vectors 
where z != 1, and in fact requires that [0,0,0] turn into [0,0,0] so it 
obviously cannot do arbitrary transforms.


More information about the cairo mailing list