# yade-users team mailing list archive

## Re: Quaternion question

```THANK YOU ALL for the help!
It helped me a lot, I've found my mistake. Your advices helped me to create
such objects:
http://geom.com.ua/s1.png
http://geom.com.ua/s2.png

After that I'm getting "quaternion expert" :)

Actually I used another library
http://www.sacredsoftware.net/tutorials/Tutorials.xhtml for creating
quaternion. Also I would recommend this tutorials for understanding this
complicated topic. Maybe it is a good idea to add this link to wiki?

Thanks again

Best Regards / Mit freundlichen Grüßen /  С наилучшими пожеланиями

2009/5/7 Sergei D. <sj2001@xxxxxxxxx>

>
> > If want to play with Quaternions in python, I recommend very simple
> > euclid module: http://partiallydisassembled.net/euclid.html
> >
> > Vaclav
> >
> Anton, I have attached modified scene.xml, which I have get from your
> scene.xml
> with Vaclav's euclid.py (Vaclav, thanks!) and typing the follow commands
>
> from euclid import *
>
> q1 = Quaternion.new_rotate_axis(pi/6, Vector3(0,1,0)) # rotate about Y
> on pi/6 angles
> q2 = Quaternion.new_rotate_axis(pi/2, Vector3(0,0,1)) # rotate about Z
> on pi/2 angles
>
> # now, YADE's se3 is [X,Y,Z, Ax,Ay,Az, a]
> # where X,Y,Z is the body's position;
> # Ax,Ay,Az is the rotation axis,
> # a is the rotation angle.
> # So, we...
> o1 = q1.get_angle_axis() # get angle and axis for the first blue box
> o2 = (q2*q1).get_angle_axis() # get angle and axis for the second blue
> box (first rotation about Y, after this rotation aboud Z)
> # Then, we set the parameters,
> O.bodies[1].phys['se3'] = [0,0,0, o1[1][0], o1[1][1], o1[1][2], o1[0]]
> O.bodies[3].phys['se3'] = [0,0,0, o2[1][0], o2[1][1], o2[1][2], o2[0]]
>
>
>
>
> _______________________________________________