# quaternion

Hi everyone, Plz tell me funda of quaternion how can we calculate from euler angle and please tell me how can I calculate q[w,x,y,z] factor.

You donât want to calculate quaternions from Euler angles. You want to stop using Euler angles at all. You donât want, at any point in your program, to think of an objectâs orientation as 3 angular rotations.

As for the whyâs and howâs of this, Iâve covered that over here.

Thanks for link, âAny pure orientation change from one coordinate system to another can be represented by a rotation about some axis by some angleâ thats fine now I can visualise with some other aspect, but
[ATTACH=CONFIG]427[/ATTACH]

why theta/2
is there any derivation

why theta/2
is there any derivation

The Internet is where you are right now. If you want to know how a formula was derived, you could simply look it up. Iâm sure the Wikipedia article on quaternions could explain it.

I am unable to find out any content about half angle,please if you have any, mention it . thanks in advance.:doh:

http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation says that it is to enable the encoding of both count and counter-clockwise rotations.

As I see it, if you were to use:

``````q = cos (theta) + (Ux*i + Uy*j + Uz*k)*sin(theta)
``````

Then since sin and cos repeat every 360 degrees, you couldnât tell the difference between rotating (X) degrees and (N*360+X) degrees. This would mean you could only encode rotations from -180 to +180 degrees (0-360 degrees if you are only rotating one way)

Using:

``````q = cos (theta/2) + (Ux*i + Uy*j + Uz*k)*sin(theta/2)
``````

then cos & sin only repeat every 720 degrees, so you can represent -360 to 360 degree rotations. (or 0-720 degrees if only in one direction)