[cairo] Rotations with Quaternions

Bill Spitzak spitzak at gmail.com
Tue Jan 23 16:31:02 UTC 2018

That program is only doing orthographic projections. In effect this is a
focal length of infinity and the resulting projections are affine which
Cairo already supports. I think when people talk about 3D projections, they
expect perspective with vanishing points.

Although such a projection from an input plane to an output quad can be
represented by a 3x3 matrix, that does not provide enough information to do
a rotation. If the camera is perpendicular to a plane, you get the same
image if the plane is very close to the camera and it has a wide angle of
view, as if it is far from the camera and the angle of view is narrower,
and you get the same 3x3 matrix. However if you rotate the plane about the
vertical axis by some amount, the resulting image is different for the
close-up wide-angle plane than for the far-away narrow-angle plane (there
will be much more perspective for the close-up one). This shows that a 3x3
matrix does not have enough information to perform a 3d rotation.

On Mon, Jan 22, 2018 at 3:41 PM, <cecashon at aol.com> wrote:

> Hi Bill,
> I took a look at your drawings of the checker pattern. They can be drawn
> with 3d rotations using quaternions. The rotations use a cairo transform so
> the drawing doesn't change how fonts are drawn. Nothing is changed
> internally in Cairo.
> If you get a chance could you take a look at the following
> https://github.com/cecashon/OrderedSetVelociRaptor/blob/
> master/Misc/cairo_drawings/rotation2.c
> I have had some trouble getting the rotations to follow the "aircraft"
> spec but it is more a matter of how the axis are labelled for that. The
> drawing has a few squares that are rotated and their perspective changes
> along with the rotation. Similar to your checker board drawings.
> Appreciate any comments.
> Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20180123/37ce5f19/attachment.html>

More information about the cairo mailing list