operations on rotations/quaternions ?

All about writing scripts for Celestia in Lua and the .cel system
Topic author
Rjp buisson
Posts: 31
Joined: 18.03.2002
With us: 22 years 8 months
Location: Paris France

operations on rotations/quaternions ?

Post #1by Rjp buisson » 13.05.2004, 16:04

I am now trying to understand rotations/quaternions manipulation in lua-celx.
Concerning the document:
Celx Objects and Methods (for Celestia version 1.3.2)
(file version 1.5 -- April 26, 2004)
availaible on Don site,
I have a few questions:

1- is there a observer:getoriention() or observer:getrotation() method available?

2- what difference (in effect and in parameter type) between
observer:setorientation(rot1)
observer:rotate(rot2)

3-there are 4 diferents binairy operators with 'rotations':
rot1+rot2
rot1*rot2
rot1*scalar
rot1*vector
Are the definition of the first 3 operators conform to the corresponding operators on Quaternions (algebra structure)?

4- what is the definition and meaning of the 4th mixed product (rot2= rot1*vector ) ??

Thanks to all of you...
JPierre.

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Re: operations on rotations/quaternions ?

Post #2by Harry » 13.05.2004, 17:23

Rjp buisson wrote:1- is there a observer:getoriention() or observer:getrotation() method available?
Yes, the first one (i.e. getorientation() ) is available (and documented, you probably overlooked it).
2- what difference (in effect and in parameter type) between
observer:setorientation(rot1)
observer:rotate(rot2)
setorientation() sets the orientation to the value rot1, completely ignoring the current orientation - the result will not depend on the current orientation. rotate() takes the current orientation, rotates it by rot2 and uses the result as the new orientation, i.e. the new orientation depends on the old orientation.

3-there are 4 diferents binairy operators with 'rotations':
rot1+rot2
rot1*rot2
rot1*scalar
rot1*vector
Are the definition of the first 3 operators conform to the corresponding operators on Quaternions (algebra structure)?
4- what is the definition and meaning of the 4th mixed product (rot2= rot1*vector ) ??

I am not really sure, CELX is simply using whatever definition Celestia is using. Have a look at:
http://cvs.sourceforge.net/viewcvs.py/celestia/celestia/src/celmath/quaternion.h?view=markup
this is where the operations are defined in C++, notably
operator+(Quaternion<T> a, Quaternion<T> b)
operator*(Quaternion<T> a, Quaternion<T> b)
operator*(Quaternion<T> q, T s)

rot*vector is the wrong way, it should have been vector*rot (defintion is in source, operator*(Vector3<T> v, Quaternion<T> q) ) - this has been a mistake, I take your question as a hint to change it...

Now that you ask: what operations on quaternions are useful and should be available in CELX?

Harald

Topic author
Rjp buisson
Posts: 31
Joined: 18.03.2002
With us: 22 years 8 months
Location: Paris France

Re: operations on rotations/quaternions ?

Post #3by Rjp buisson » 14.05.2004, 10:17

Harald wrote:Now that you ask: what operations on quaternions are useful and should be available in CELX?


Thanks Harry
I am glad to have now a link to the source code of Celestia,which I didn't have ...
Mentionned operators seem to be coherent with the algebra structure of Quaternions.
As you already know, Quaternions are new to me, but I intend to understand that stuff and test it in lua celx, and then documant on that subject when clear in my mind...
I'll contact you as soon as possible...
JP


Return to “Scripting”