Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trying to understand rotation

Jack Abraham
Lantern By Day
Join date: 11 Apr 2008
Posts: 113
03-27-2009 09:52
Can anybody suggest a good resource to help me understand rotations in their various notations, when one would want to use each, and how the transformations work? The wiki just isn't giving me enough to go on, as it assumes some math I never had. I'd be willing to pick up a textbook if someone can recommend one that's usable without a professor.
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
03-27-2009 10:07
Quaternions (the rotations used by SL) are quite a tricky area, especially because it's only a special type that is used to represent rotations. Your best bet is usually to look at games-programming related texts, since they explain what you need to know to use them, rather than all the ridiculously complicated background maths.

Here's an article on GamaSutra. I haven't read the whole thing, but they usually have good stuff:

http://www.gamasutra.com/view/feature/3278/rotating_objects_using_quaternions.php
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
understand rotation
03-27-2009 11:02
Do not try to understand how quaternions work! learn what rules apply to them!

Nobody can picture what they are like human beings can't imagine a space with more than 3 dimensions. That fact does not prevent mathematicians from making math for spaces with much more than 3 dimensions:)
_____________________
From Studio Dora
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-27-2009 11:05
From: Jack Abraham
Can anybody suggest a good resource to help me understand rotations in their various notations, when one would want to use each, and how the transformations work? The wiki just isn't giving me enough to go on, as it assumes some math I never had. I'd be willing to pick up a textbook if someone can recommend one that's usable without a professor.


Are you refering to http://wiki.secondlife.com/wiki/Rotation? If not, take a look. It's pretty straightforward.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
03-27-2009 14:21
I agree with Rolig -- the SL wiki article on rotations is pretty accessible, even for a non-mathematician like me.

In addition, I was given some extremely helpful guidance on the subject in this thread /54/90/295032/1.html and I frequently find myself referring to Void Singer's cheat sheet at http://wiki.secondlife.com/wiki/User:Void_Singer/Rotations

I think one of the most useful things ever written on the subject was by Francis Chung at /54/3b/50692/1.html#post540396
From: someone
For what it's worth, I don't think it's really beneficial to understand the ins and outs of how quaternions work inside LSL. I think of rotations as just that - a data structure that describes a rotation. I don't much care that it has 4 elements or anything.

The important properties are:
- You can transform a vector with them
v*r = v'
- You can compose rotations together
r1 * r2 = r3
- Rotations are all invertible, and associative, but not commutative
1/r, (r1*r2)*r3 = r1*(r2*r3), r1*r2 != r2*r1
- You can use all these ll* functions to manipulate them.
http://secondlife.com/badgeo/wakka.php?wakka=Rotation

I haven't found a reason yet why anyone would need a deeper understanding than that inside LSL.

The only time where it becomes important to understand a quaternion is when you want to manipulate them outside LSL.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-27-2009 14:47
Blast, you can't put images in this forum?

http://images.icanhascheezburger.com/completestore/2009/3/27/128826641247812908.jpg
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-27-2009 14:54
From: Argent Stonecutter


Nothing but ferrets, I guess. :p

I always have to post links to flickr. The forums' image capabilites are flaky, to put it mildly.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 15:19
testing..............

[img]http://images.icanhascheezburger.com/completestore/2009/3/27/128826641247812908.jpg[\img]


Nope. Looks like ferrets are SOL.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 15:23
From: Argent Stonecutter
Blast, you can't put images in this forum?

[img]http://images.icanhascheezburger.com/completestore/2009/3/27/128826641247812908.jpg?[\img]

back \ not forward /
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-27-2009 15:36
The Wikipedia articles are also pretty decent, though there's a lot you can probably skip.

http://en.wikipedia.org/wiki/Quaternion
http://en.wikipedia.org/wiki/Quaternion#Quaternions_and_the_geometry_of_R3

http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Parameterizing_the_space_of_rotations_with_quaternions
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-27-2009 17:29
From: Jesse Barnett
back \ not forward /

Um, no, never backslash. Ever.

This particular forum has disabled inline images.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
03-27-2009 17:42
The pictures of the ferret appear for me, but then I'm using BBCode in Text.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 18:16
From: SuezanneC Baskerville
The pictures of the ferret appear for me, but then I'm using BBCode in Text.

Yep mine are working for me in both Opera and Firefox
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 18:17
From: Argent Stonecutter
Um, no, never backslash. Ever.

This particular forum has disabled inline images.

except mine are working and yours aren't :p
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-27-2009 18:28
From: Jesse Barnett
except mine are working and yours aren't :p

Yours aren't working. You're being fooled by your browser extension - and your browser extension is buggy. "\" is not legal syntax, and must not be accepted. Mine is explicitly a link, not an image, using the "?" trick. If I didn't have the "?" it would work fine for you, but not for people who are using standard browsers without hacks... and that's what matters to me.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 18:37
From: Argent Stonecutter
Yours aren't working. You're being fooled by your browser extension - and your browser extension is buggy. "\" is not legal syntax, and must not be accepted. Mine is explicitly a link, not an image, using the "?" trick. If I didn't have the "?" it would work fine for you, but not for people who are using standard browsers without hacks... and that's what matters to me.

Except that it IS working with Strife's bbcode script in BOTH Google Chrome and Firefox.

If it is working then that does not mean that it is not working.........................................

The forums have needed the bbcode hack for quite a while now to work properly. Impossible to get code to show properly any other way so I do not strive to get my posts to work for people stuck using IExplorer.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
03-27-2009 18:44
A discussion of the forum's img posting condition is off topic and in the wrong forum.

Regarding
From: someone
- Rotations are all invertible, and associative, but not commutative
1/r, (r1*r2)*r3 = r1*(r2*r3), r1*r2 != r2*r1


I understand the English but don't get all the formula part.

The formula part would be clearer (to me, that is) on three lines, because those are three separate things that looked to me at first like one big thing that didn't make any sense.

It starts out "1/r"; what does the reciprocal of r mean? If you rotate something by R, does 1/R rotate it back?

I wish there built in relative rotation commands in LSL, I find them convenient and easy to understand. "llSpinXdegrees(45), llSpinYdegrees(15), something like that.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
03-27-2009 19:33
From: SuezanneC Baskerville

It starts out "1/r"; what does the reciprocal of r mean? If you rotate something by R, does 1/R rotate it back?
Yeah.. according to the wiki,
From: someone
The multiply operation applies the rotation in the positive direction, the divide operation does a negative rotation. You can also negate a rotation directly, just negate the s component, e.g. X.s = -X.s.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-27-2009 19:33
From: Jesse Barnett
Except that it IS working with Strife's bbcode script in BOTH Google Chrome and Firefox.
You're just repeating what I said. It's not working with a normal browser with no extensions. It's only working with Strife's hack.

From: someone
The forums have needed the bbcode hack for quite a while now to work properly.
I don't use it. The code shows up correctly in the edit pane when I quote it.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 20:48
From: SuezanneC Baskerville
A discussion of the forum's img posting condition is off topic and in the wrong forum.

And?

Also it definitely is not in the wrong forum. Notice that there have been no further updates even in the office meetings of a forum update? This is all we have and it looks like all we are ever going to have and it is less and less functional everyday. Just a couple of months ago you could attach images and docs to the scripting forum although you couldn't in RA for a long time................
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ephraim Kappler
Reprobate
Join date: 9 Jul 2007
Posts: 1,946
03-27-2009 20:52
Quaternions are a deeply disturbing, almost frightening concept.

There: a pointless observation but nonetheless back on topic.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 21:15
I guess the two biggest rotation formulas to commit to memory are:

CODE

//rotate an object on it's z axis 90 from whatever rotation it is at
llSetRot(llGetRot() * llEuler2Rot(<0, 0, 90 * DEG_TO_RAD >));

//and add a rotation to a vector. In this case rez an object so that it is in front of the av, no
matter what direction they are facing:
llRezObject("obj_name", llGetPos() + (<0,0,1> * llGetRot()), ZERO_VECTOR, ZERO_ROTATION, rez_chan);
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-27-2009 22:27
EDIT: removed for clarity, see later post.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-28-2009 00:01
From: Void Singer
DO use
rotation.s *= -1;

do NOT use
rotation / rotation (except as described in known workarounds)

if the wiki still says divide is a negative rotation, the wiki LIES...
rotation division, is akin to an unRotate (as Lex had to pound into me), which is not the same as reversal of direction(more pounding). there are some edge cases where it'll work for that, but mostly it'll exhibit weird behavior, like 3 (or more) different positions as you repeatedly apply it, given a non world aligned prim.

ps, I really do need to update that rotations page of mine with simpler language, and some new tricks

Eh? Not sure what you mean by that. "Dividing" by a rotation does, in fact, give you the inverse transformation. If you take a vector or rotation, "multiply" it by a rotation R, then "divide" it by the same rotation R, you'll get your original vector/rotation. If you want to get the inverse rotation to R without immediately applying it to some value, you can take 'ZERO_ROTATION/R'. That's the equivalent of reversing either the angle OR axis direction of the rotation, and you can get the same thing by reversing the sign of the 's' component as you did. To be a little more correct, you'd actually reverse the sign of all the other components and leave 's' unchanged, but in practice reversing just 's' works too in LSL. That is because the LSL "multiplication" by a quaternion actually performs two multipllcations; one by the quaternion itself and one by its conjugate. so multiplying the quaternion by -1 just results in multiplying the whole result by -1*-1 = +1.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-28-2009 10:35
EDIT: removed for clarity, see later post.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
1 2