[cairo] Rotations with Quaternions

cecashon at aol.com cecashon at aol.com
Wed Jan 10 19:13:39 UTC 2018


 
Hi Bryce,

A 3x3 matrix should might work for quaternion rotations. In the sample code this is reduced to a 2x2 matrix, or four variables for each circle rotation, by using initial reference points but that wouldn't work in general to preserve rotations. There would be a need to keep the z component of a plane to make the rotations additive. If you assumed z=0 then a first rotation would work but not a second or it wouldn't work as expected.

This probably is something difficult to add to Cairo. There are a lot of places that the cairo_matrix_t touches in the code. Also I think there would be a need for a new matrix for quaternion rotations and if that is done then you run into further difficulties such as the order of matrix multiplication. A lot of speculation at this point.

I got going on this to figure out 3d rotations using Cairo's api. I could get some special case rotations in 3d but not something that would work for a gyro. Working on putting together a little gyro widget with Cairo and GTK. 

I am not familiar with the internals of Cairo. I have looked around a little but I don't have a test setup with the current version. Do you have any suggestions for putting together a test setup? I would be interested in getting a test build set up that I could experiment with. Also to take a look at what you have going with projections.

Eric

 


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


More information about the cairo mailing list