Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## Re: [Algorithms] Quaternions

 Re: [Algorithms] Quaternions From: Neal Tringham - 2000-12-30 11:59:50 Joe Ante writes >Hi, > >I just wanted to write code for a quaternion based third person camera >(currently i am using a spring-based camera) > >Now I want to smoothly slerp between changing orientations. >So what i dont understand is how o find out with wich speed you slerp >between two orientations. >I want the camera to rotate with always the same speed, but it is possible >that the from, to orientations are more or less spherically far away from >each other. So I want to find out the length which you travel on the great >arc from one to the other orientation. > >Did that make any sense? >Actually I wonder why all these quaternion tutorials, >dont mention this. I seem not to understand how you can smoothly animate >your camera otherwise. If you can express the change you want to apply to the camera's orientation as a quaternion (e.g. take the rotation you would expect to apply in a second, scale it by one over your frame rate, and then use that angle and your axis of rotation to generate the quaternion), then you could potentially use quaternion multiplication to get the next camera orientation rather than slerp. Or not:-) Neal Tringham (Sick Puppies / Empire Interactive) (neal@...) (neal@...)

### Thread view

 [Algorithms] Quaternions From: Max - 2000-11-16 21:33:21 Attachments: Message as HTML Hi! This is probably some simple question, but I can't seem to find an = answer. Could somebody please point me to some place about quaternions? = What are they actually? Are they only used in D3D? I was programming = using OpenGL for some time now, but now I've started reading DX8 docs. I = didn't meet quaternions in OpenGL, and it seems those are very important = in D3D. Thanks, and sorry if this is offtopic Max
 [Algorithms] Quaternions From: Joe Ante - 2000-12-29 22:37:58 Hi, I just wanted to write code for a quaternion based third person camera (currently i am using a spring-based camera) Now I want to smoothly slerp between changing orientations. So what i dont understand is how o find out with wich speed you slerp between two orientations. I want the camera to rotate with always the same speed, but it is possible that the from, to orientations are more or less spherically far away from each other. So I want to find out the length which you travel on the great arc from one to the other orientation. Did that make any sense? Actually I wonder why all these quaternion tutorials, dont mention this. I seem not to understand how you can smoothly animate your camera otherwise. bye joe
 Re: [Algorithms] Quaternions From: Neal Tringham - 2000-12-30 11:59:50 Joe Ante writes >Hi, > >I just wanted to write code for a quaternion based third person camera >(currently i am using a spring-based camera) > >Now I want to smoothly slerp between changing orientations. >So what i dont understand is how o find out with wich speed you slerp >between two orientations. >I want the camera to rotate with always the same speed, but it is possible >that the from, to orientations are more or less spherically far away from >each other. So I want to find out the length which you travel on the great >arc from one to the other orientation. > >Did that make any sense? >Actually I wonder why all these quaternion tutorials, >dont mention this. I seem not to understand how you can smoothly animate >your camera otherwise. If you can express the change you want to apply to the camera's orientation as a quaternion (e.g. take the rotation you would expect to apply in a second, scale it by one over your frame rate, and then use that angle and your axis of rotation to generate the quaternion), then you could potentially use quaternion multiplication to get the next camera orientation rather than slerp. Or not:-) Neal Tringham (Sick Puppies / Empire Interactive) (neal@...) (neal@...)
 Re: [Algorithms] Quaternions From: Jeff Lander - 2000-11-16 22:05:35 See my articles online about using Quaternions for animation in OpenGL: http://www.darwin3d.com/gdm1998.htm#gdm0398 http://www.darwin3d.com/gdm1998.htm#gdm0498 As you will see, the way OpenGL expresses rotations is in axis-angle form which is very compatible with quaternions. Also, do yourself a favor and don't bring this topic up on any public newsgroups. Quaternions for some reason reason have become a big deal. It seems to me that it is just another tool that is useful in certain situations. -Jeff ============================================ Darwin 3D http://www.darwin3d.com Game Technology Seminars http://www.techsem.com At 10:29 PM 11/16/2000 -0800, you wrote: >Hi! > > This is probably some simple question, but I can't seem to find an answer. Could somebody please point me to some place about quaternions? What are they actually? Are they only used in D3D? I was programming using OpenGL for some time now, but now I've started reading DX8 docs. I didn't meet quaternions in OpenGL, and it seems those are very important in D3D. >Thanks, and sorry if this is offtopic >Max
 Re: [Algorithms] Quaternions From: Stephen J Baker - 2000-11-16 22:35:08 On Thu, 16 Nov 2000, Max wrote: > This is probably some simple question, but I can't seem to find > an answer. Could somebody please point me to some place about > quaternions? What are they actually? Are they only used in D3D? I was > programming using OpenGL for some time now, but now I've started > reading DX8 docs. I didn't meet quaternions in OpenGL, and it seems > those are very important in D3D. Quaternions are *useful* in many 3D applications - there isn't specific support for them in OpenGL - but the glRotate command works *very* similarly to a quaternion - except that the scaling of the angle term is a little different. A quaternion is essentially an axis to rotate around - and an amount to rotate through. If you type 'Quaternion' into any search engine, you'll get 1e6 tutorials. Essentially, most applications that use them only need them at the level of the application. When it comes to transforming vertices, a matrix is significantly more efficient. Hence, you tend to use quaternions to compose/interpolate/combine rotations and then you convert them into a matrix at the last minute before you hand them over to the graphics API. Hence, it's not generally significant that OpenGL doesn't directly support them...it doesn't need to. I doubt that D3D does anything much with them - other than to immediately convert them into matrices. ---- Steve Baker (817)619-2657 (Vox/Vox-Mail) L3Com/Link Simulation & Training (817)619-2466 (Fax) Work: sjbaker@... http://www.link.com Home: sjbaker1@... http://web2.airmail.net/sjbaker1