[cairo] [patch] enable projective transformations

Andrea Canciani ranma42 at gmail.com
Tue Aug 17 11:16:28 PDT 2010


On Tue, Aug 17, 2010 at 8:08 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> 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.

A 3x3 CAN do any 2d homogeneous linear transformation, including 2D translation:

[ 1 0 0 ]
[ 0 1 0 ]
[ tx ty 1]

Transforms [x y 1] in [x+tx, y+ty, 1]
Remember that the homogeneous coordinate is 1 (and is normalized
to 1 whenever it assumes a different value).


More information about the cairo mailing list