PDA

View Full Version : Convert Vector to....



11-08-2005, 04:03 AM
Hello !

Could you please tell me how to convert a VECTOR to a QUATERNION ?

( I just need the QUATERNION with PITCH & YAW. I don't need the ROLL. )

Thanks.

Cheps
11-08-2005, 06:15 AM
You can't convert a vector to a quaternion, they are totally different things. If you mean converting your vector based rotations to quaternions, you should glGoogle(opengl quaternion rotation) :)

11-08-2005, 08:25 PM
Hi !

Thanks.

Given a Vector, ( which has some 'theta' with respect to XZ-PLANE & some 'phi' with respect to XY-PLANE ), we can have PITCH, YAW & ROLL(=0. i.e we assume it to be 0) and convert these angles ( EULER angles ? ) to a QUATERNION.

How do I get a quat ?

Looking forward to your reply.

Thanks.

Cheps
11-08-2005, 10:48 PM
Explaining it would be too long, and as I said there are MANY quaternions tutorials available.

For an understanding on using quaternions for rotations, you should check http://www.gamedev.net/reference/articles/article1095.asp .

For a good example, check http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=Quaternion_Camera_Class .

You could just copy/paste the example, but understanding how it works allow you to adapt it to your neededing.

11-08-2005, 11:39 PM
Thanks a lot !

:cool: