Combining quaternions...
|
gene Poole
"Foolish humans!"
Join date: 16 Jun 2004
Posts: 324
|
03-16-2005 13:06
For those of us who are too lazy ATM to think about quaternions for real, can we get a shortcut verified?
How can one express the net result of two quat rotations combined? Is it addition, multiplication, or what? With "normal" (Eulerian) rotations, I can sum the triples. For instance, <PI, 0, 0> + <0, PI, 0> = <PI, PI, 0>
How can I "combine" quaternions?
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
03-16-2005 13:30
Multiplying rotations is the standard way of combining them. Dividing rotations is the standard way of inverting them. So if you want to rotate something relative to the current object, add "* llGetRot()" If you want say, to rotate a child prim, add "/ llGetRootRotation()"
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-16-2005 14:32
Hate to be a stickler Eggy, but I did this just last night - you want * llGetRootRotation() for rotating a child prim relative to the root. Here's a simple list of examples: rotation start = <0,0,0,1>; rotation test = <0.70711,0,-0.70711,-0>;
// Now, first of all, order DOES MATTER when using quaternions. // First, let's start with rotation "start" and move by the amount of rotation "test"
rotation new = test * start;
// This starts at <0,0,0,1> (no rotation), and rotates by the amount in test. // Now, if we do this:
new = new / test;
// Or new /= test; ... // The rotation for new should evaluate <0,0,0,1> again. This is because we have // just gone in the OPPOSITE direction by arc distance test.
// Now, let's try two more interesting tricks.
vector vect = <0,0,1>; vect *= test;
// Now we have just moved this vector into a local frame. It will now evaluate // a distance along the Z-axis of an object that is at rotation test.
// The opposite of this operation, then, is just:
vect /= test;
// ... which should evaluate exactly, or very close to <0,0,1>. And believe me, this stuff is very useful.  If you want an even more technical explanation, try here: http://www.cprogramming.com/tutorial/3d/quaternions.html
_____________________
---
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
03-16-2005 17:09
I said "rotating a child", not "relative to the root", but rather, ignoring / inverting / subtracting the rotation that the root primitive forces upon it. /me goes look up stickler in the dictionary now
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-16-2005 17:48
Okay, okay. You win. 
_____________________
---
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
03-17-2005 00:41
w00t! TEH pwnz0red! lolololololo Eggy Lippmann 4tehwin!  It's not a contest Jeffmeister... I was just citing the two examples of "Combining quaternions" I have used in the past...  I don't mean to sound arrogant or something but I'm hardly ever wrong. This isn't because I know everything. I don't. It's just that I have put myself through shame and embarassment enough times in my life that I tend to keep quiet when the possibility exists that I would have to go through it again.
|
blaze Spinnaker
1/2 Serious
Join date: 12 Aug 2004
Posts: 5,898
|
03-17-2005 11:19
guru prize will go to whoever gives me the actual formula that they are actually using to combine quaternions
(guessing doesn't count)
_____________________
Taken from The last paragraph on pg. 16 of Cory Ondrejka's paper " Changing Realities: User Creation, Communication, and Innovation in Digital Worlds : " User-created content takes the idea of leveraging player opinions a step further by allowing them to effectively prototype new ideas and features. Developers can then measure which new concepts most improve the products and incorporate them into the game in future patches."
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-17-2005 11:55
Huh? Thought I already did a la code examples? That's, ahh... kinda what I use.And Eggy, s'alright. 
_____________________
---
|
blaze Spinnaker
1/2 Serious
Join date: 12 Aug 2004
Posts: 5,898
|
03-17-2005 12:09
No, mathematically. Search the forum, I posted this question before. Even the linden's couldn't answer.
(Guess they're just using some library..)
_____________________
Taken from The last paragraph on pg. 16 of Cory Ondrejka's paper " Changing Realities: User Creation, Communication, and Innovation in Digital Worlds : " User-created content takes the idea of leveraging player opinions a step further by allowing them to effectively prototype new ideas and features. Developers can then measure which new concepts most improve the products and incorporate them into the game in future patches."
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-17-2005 12:12
_____________________
---
|
blaze Spinnaker
1/2 Serious
Join date: 12 Aug 2004
Posts: 5,898
|
03-17-2005 12:14
Yeah, well, I think you're guessing now 
_____________________
Taken from The last paragraph on pg. 16 of Cory Ondrejka's paper " Changing Realities: User Creation, Communication, and Innovation in Digital Worlds : " User-created content takes the idea of leveraging player opinions a step further by allowing them to effectively prototype new ideas and features. Developers can then measure which new concepts most improve the products and incorporate them into the game in future patches."
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-17-2005 12:19
Check the other thread, please... my guess is the link URL-blocks or somesuch. 
_____________________
---
|
gene Poole
"Foolish humans!"
Join date: 16 Jun 2004
Posts: 324
|
03-19-2005 09:40
No, Jeff's right, but I just didn't care to think about the math at the time. Anyway, somehow I managed to miss the Combining Rotations section on the wiki. Oh, the humiliation! 
|