Xojo Conferences
MBS | Oct | 2019 | Cologne | DE |
RB3D: Difference between two quaternions (Real Studio network user group Mailinglist archive)
Back to the thread list
Previous thread: Supported MySQL Table Types - InnoDB?
Next thread: copyfolder method or class?
RB3D: Difference between two quaternions |
Date: 28.08.02 20:43 (Wed, 28 Aug 2002 21:43:50 +0200) |
From: Frank Bitterlich |
Hi list,
is there a way to find out the angle (difference) between two quaternions in degrees (or radians)? I guess so, but I'm not exactly a rocket scientist when it comes to 3D math... Thanks is advance, Frank+++ |
Re: RB3D: Difference between two quaternions |
Date: 28.08.02 21:04 (Wed, 28 Aug 2002 13:04:18 -0700) |
From: Joseph J. Strout |
At 9:43 PM +0200 8/28/02, Frank Bitterlich wrote:
>is there a way to find out the angle (difference) between two >quaternions in degrees (or radians)? I guess so, but I'm not exactly a >rocket scientist when it comes to 3D math... Hmm... I think this depends on exactly what you mean. Literally speaking, the difference between two quaternions is another quaternion (the rotation that would be needed to go from orientation q1 to orientation q2). But I think you mean one of the following: 1. How close are q1 and q2 to representing the same orientation? In this case, the dot product (q1.x*q2.x + q2.y*q2.y + q1.z*q2.z + q1.w*q2.w) will be helpful. As with 2D and 3D vectors, the dot product of two normalized quaternions is equal to the cosine between them (in 4D space). 2. How far apart would two vectors (that start with the same value) be after being rotated by q1 and q2? In this case, just do it and see: make a vector v1 and v2 (both initialized to <1,0,0> or any other normalized vector), transform them by q1 and q2 respectively, and then take the dot product of the resulting vectors. That's the cosine of the angle between them. Of the two, I'd guess #2 is more likely what you want. HTH, - Joe |
Re: RB3D: Difference between two quaternions |
Date: 28.08.02 21:33 (Wed, 28 Aug 2002 22:33:52 +0200) |
From: Frank Bitterlich |
"Joseph J. Strout" wrote:
> > At 9:43 PM +0200 8/28/02, Frank Bitterlich wrote: > > >is there a way to find out the angle (difference) between two > >quaternions in degrees (or radians)? I guess so, but I'm not exactly a > >rocket scientist when it comes to 3D math... > > Hmm... I think this depends on exactly what you mean. Literally > speaking, the difference between two quaternions is another > quaternion (the rotation that would be needed to go from orientation > q1 to orientation q2). But I think you mean one of the following: > > 1. How close are q1 and q2 to representing the same orientation? In > this case, the dot product (q1.x*q2.x + q2.y*q2.y + q1.z*q2.z + > q1.w*q2.w) will be helpful. As with 2D and 3D vectors, the dot > product of two normalized quaternions is equal to the cosine between > them (in 4D space). Aha. Until now I thought that 4D was a database, or something Stephen Hawking is working with. What I'm trying to accomplish is a camera sweep; I'm doing it with successive calls to .SetBetween, and I want to find out the number of steps I need so that the camera sweeps at a constant speed, regardless how "far" the objects (or the angles between them) are apart. The seeping routine is based on the code from your RB3D FAQ. > 2. How far apart would two vectors (that start with the same value) > be after being rotated by q1 and q2? In this case, just do it and > see: make a vector v1 and v2 (both initialized to <1,0,0> or any > other normalized vector), transform them by q1 and q2 respectively, > and then take the dot product of the resulting vectors. That's the > cosine of the angle between them. That sounds like what I want. I'll give it a try. Thanks, Frank+++ |
Re: RB3D: Difference between two quaternions |
Date: 28.08.02 21:41 (Wed, 28 Aug 2002 13:41:13 -0700) |
From: Joseph J. Strout |
At 10:33 PM +0200 8/28/02, Frank Bitterlich wrote:
>Aha. Until now I thought that 4D was a database, or something Stephen >Hawking is working with. Heh, now you and he would have something to chat about at a party. > What I'm trying to accomplish is a camera >sweep; I'm doing it with successive calls to .SetBetween, and I want to >find out the number of steps I need so that the camera sweeps at a >constant speed, regardless how "far" the objects (or the angles between >them) are apart. The seeping routine is based on the code from your RB3D FAQ. Ah, right, then it's approach 2 you want. Let me know if it gives you any trouble. Cheers, - Joe |