[cairo] Rotations with Quaternions
cecashon at aol.com
cecashon at aol.com
Wed Jan 31 23:52:52 UTC 2018
These are a couple of 3d drawings using Cairo.
https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/spring1.c
There is a spring that has 3d points and uses a 2x3 rotation matrix to get the 2d points to draw with. It also has perspective by adjusting the x and y values by the z value. Just played around with this a little. A cylinder that uses a 2x3 rotation matrix but doesn't clip on the z-plane. And a cube that uses a 3x3 rotation matrix since it needs to retain the z values for clipping. The cube uses a cairo_scale to give it a distance perspective in the animation. The 3d points are eventually mapped to the 2d screen so you can use cairo 2d transform functions.
Cairo is a 2d library but being able to do a few things in 3d might be helpful. Makes drawing and animation some fun also. I still have a lot to figure out with this though.
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20180131/c460a6ce/attachment.html>
More information about the cairo
mailing list