I don’t think quaternions are the right thing to use here. They are great for keeping track of orientation (among other things), but not simple rotation.
So, are you looking for code that spits out numbers? If so, then OpenGL has nothing that will help you.
Do you want to render this scene? Then take a look at glRotate.
Originally posted by Jambolo:
[b]I don’t think quaternions are the right thing to use here. They are great for keeping track of orientation (among other things), but not simple rotation.
So, are you looking for code that spits out numbers? If so, then OpenGL has nothing that will help you.
Do you want to render this scene? Then take a look at glRotate.[/b]
Basically what I am trying to do is draw bended pipe in a 3D space (for straight sections I am using gluCylinder, and for bends I am drawing a part of torus also using OpenGl).
So what I am trying to do is write my positioning algorithm that calculates my starting position x,y,z, and then I rotate and transform section of a pipe into that position. That’s why I thought quaternions would be the most straight forward for my positioning algorithm.
For rotating and translating, the best bet is regular matrices. It doesnt sound like you’re doing anything strange that would require quats, which are more advanced than regular matrices.
Use glrotate and gltranslate, or at least read about them. They are matrices used to translate and rotate vertices