Maths - Rotations using quaternions - message from minorlogic

By: minorlogic ( Michaele Norel )
file RE: quternion from 2 vec  
2003-08-27 12:23

Found in GDA mailing list archives, very simple trip.
Here we get result, how create quaternion of the half rotation. We get that we can just add the 1 to w component.

The same we can get if we will lineary lerp from identity quaternion ( w== 1) to given by half.

0.5*q + 0.5*q_ident -> scale it by 2

we get the same result without the complicated math. That is so simple.

By: martinbaker ( Martin Baker )
file RE: quternion from 2 vec  
2003-08-27 16:16

Hi minorlogic,

Can I just check what you are saying? As an example assume I am rotating 90' about the z-axis.
The would be represented by quat = k

Half that angle would be given by quat = cos(45') + k sin(45')
= 0.707 + k 0.707

Are you saying that I can derive this from the first equation by adding 1 to give
1 + k
and then normalising?

That's very interesting, do you know why this is so? Do you have a derivation? Can you think of a way to say, divide the angle into 3 parts?


By: minorlogic ( Michaele Norel )
file RE: quternion from 2 vec  
2003-08-28 08:20

From dot and cross product we can get the quaternion of DOUBLE angle rotation

q( x*sin a, y*sin a, z*sin a, cos a);
but we need the quat of angle rotation
q( x*sin a/2, y*sin a/2, z*sin a/2, cos a/2);

So we need to get quaternion from double angle -> to angle.

This quaternion "lay between" identity quaternion
q(0,0,0,1 ) and given double angle quaternion. We can just lerp this two quaternions.

So as we find bisector of two unit vectors just adding tham, we add to double angle quaternion ( must be same magnitude ) identity quaternion and normalize it.

lets play with your example:
quaternion double_a_q( 0*sin(90), 0*sin(90), 1*sin(90), cos(90) )

double_a_q( 0, 0, 1, 0 )
identity_q( 0,0,0,1);

Add them :

result_q( 0,0,1,1);
normalize it :
mag = sqrt(0*0 + 0*0+ 1*1 +1*1) = sqrt(2)

result_q( 0,0,1/sqrt(2),1/sqrt(2));
result_q( 0,0,0.707,0.707);

And to derive this we don't need trigonometry.

By: martinbaker ( Martin Baker )
file RE: quternion from 2 vec  
2003-08-28 17:49

Yes, I made a silly mistake in not dividing the angle by 2 when calculating the quaternion, thank you for correcting me.

I think I understand now, I have written this down at the following webpage:

Is this alright?



metadata block
see also:


Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.


cover us uk de jp fr ca Quaternions and Rotation Sequences.

Terminology and Notation

Specific to this page here:


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2017 Martin John Baker - All rights reserved - privacy policy.