Re: [PATCH 1/6] Enable projective transforms
Bill Spitzak <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
> So is adding px and py the right approach? (btw. may be there are some > more appropriate names for these elements) I think you need to have all three numbers, as the lower-right corner can be zero and thus you cannot normalize to 1. There seems to be some desire to match SVG and CSS with Cairo. This may require the use of 4x4 matrices: SVG and CSS seem to define projections with an x,y,z triple. If I understand this right, xyz are the position of the eye in space, it is facing down the -z axis, and the perspective is chosen such that the z=0 plane is unchanged. If I got the math right this is a 4x4 matrix of the following form: D = 1/z |1 0 -xD 0| |0 1 -yD 0| |0 0 0 0| |0 0 -D 1| An orthographic perspective is achieved by setting z to infinity. This is somewhat problematic so it would probably be better to have the api take the inverted D value, so orthographic is done with a value of zero and there is no need to put infinity into the api. This does not produce anything useful unless some way can be made to have points in the path have a z not equal to zero. Adding a z to the path's points may help but is much less important than adding the ability to multiply the ctm by 3d rotations about the x and y axis (or an arbitrary axis), to scale along z, and to translate along z. These are the only way for source surfaces to get perspective transforms. These concatenations only work if 4x4 matrices are used. Note that all rendering only needs the 3x3 subset where you throw away the z row and column. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo