Re: Rotations with Quaternions

[email protected]
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
 
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

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.