[cairo] Rotations and Perspective

cecashon at aol.com cecashon at aol.com
Tue Aug 7 17:58:22 UTC 2018

These are a few more programs for testing out the possibility of 3d rotations and perspective in cairo. The mesh maker program uses only cairo to rotate 2d drawings in 3d. It tests some gradients and works well.


For just rotating in cairo you could put the cairo transform in the quaternion rotation function. 

If you are rotating points manually you will want to get the rotation matrix back so that you can use it. The perspective program manually rotates some cube points. After rotation the points could be adjusted for perspective(in this case) or maybe even with a stress matrix.


Sometimes I get some line fragments here that extend a little too far but am unsure where they come from in the perspective program.

In the cairo_drawings folder there is also some boid test code to draw animated 3d objects with cairo(boids2.c and boids3.c).

Another drawing thought. When drawing in 3d you can use painters algorithm to draw from back to front. A better option sometimes might be to use the opengl depth testing. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20180807/40ebe168/attachment.html>

More information about the cairo mailing list