Page 1 of 1

positionnig/viewing in Celx:help?

Posted: 23.04.2004, 17:01
by Rjp buisson
I'm trying to fully understand positioning and viewing methods in Celx.
(for myself AND to publish an available documentation to everyone...)
Could you confirm or correct my present (mis)understanding:

1-Methods related to positioning of observer:
Two kinds of positions (but belonging the same class of Object) will be distingwished here,relative to their use:
pos_univ: position relative to universal coordinates -"universal" frame
pos_rel:position relative to another frame (ecliptic,equatorial,planetographic,lock,chase,observer)
Methods involved with positions:
obj:getposition() > pos_univ (return a position ALWAYS of type pos_univ)
obs:getposition() > pos_univ
obs:setposition(pos_univ) (argument NECESSARILY of type pos_univ)
obs:gotolocation(pos_univ,duration)

2- Methods related to camera (viewing); don't affect position of observer:
obs:lookat(from, to,up) ?? what type are supposed for those arguments???
obs:setorientation(rot) ?? typpe? and see later for questions about 'rotation'
obs:rotate(rot) ??idem

3- Methods related to frame (coordinates and coord system)
celestia:newFrame() > create a celestia frame
obs.getframe > frame
obs.setframe()
and involved with position types
frame:to(pos_univ) > pos_rel
frame:from(pos_rel) > pos_univ

And now what I am sure NOT to understand:

5-Rotation objects
5a)rotation created with:
celestia:newrotation(axis,angle) but type of axis? univ? relative?
But WHAT is exactly such an objet? the matrix of the rotation? in which coordinate system? are Euler angles involved? if Yes with which convention?...
5b)Methods involved with rotations
obs:setOrientation(rot) > rot type? what precise mathematical links between the rot argument , obs.frame and the'orientation of the camera (axis and up direction)
obs:rotate(rot) > same questions (it is supposed to modify the orientaton of the camera, but how?)

6- Finally is there a
Celestia:newposition (x,y,z) class method?

Take your time before answering..
Thanks a lot.
JPierre

Re: positionnig/viewing in Celx:help?

Posted: 24.04.2004, 00:33
by Harry
I am not exactly answering your questions, so please ask again where necessary. I just wanted to post a more general description:
A rotation-object is internally a Quaternion, which is one possibility to mathematically describe a rotation in 3 dimensions (i.e. it can be converted to a rotation matrix). A rotation can also be used to describe the orientation of objects or the observer (i.e. where the observer is looking to, and where "up" is).

You can directly create a quaternion from its components by using:

Code: Select all

rot = celestia:newrotation(w,x,y,z)

But you would have to know the values for this (BTW, these are the same values you will find in a cel://-URL).
The same method also accepts a vector and a number (an angle), but this behaves (unfortunately) somewhat different - it creates a quaternion and then calls the setAxisAngle-method on it (let's ignore what this means for the moment) - this was probably a mistake, and there should be a seperate method for this in the future.
Then there is a less abstract way to create a rotation (in this case you should think of it as an orientation): if you have two positions pos1 and pos2, the orientation which would match looking from pos1 to pos2 can be obtained by calling:

Code: Select all

rot = pos1:orientationto(pos2, up)
with up being a vector pointing up (i.e. you can define the meaning of "up" using this vector). (This is somewhat similar to the observer:lookat() method).
rotation-objects are mainly useful to manipulate the orientation of the observer. The current CVS-code has a rotation:transform(vector) method, which will apply the rotation to a vector - e.g with this you can use the rotation-object obtained via observer:getorientation() to get the vector in which the observer is looking. Until this is natively available in a Celestia-(pre)release, you can use the pure Lua-implementation of the same functionality I posted here..

6- Finally is there a
Celestia:newposition (x,y,z) class method?

Yes, with exactly that name (except for the capital C).

Re: positionnig/viewing in Celx:help?

Posted: 24.04.2004, 10:16
by Rjp buisson
Thanks Harry for your prompt and precise answer concerning rotations:

1-You gave me some hints starting USING rotations with celx. Good!
but

2-
A rotation-object is internally a Quaternion, which is one possibility to mathematically describe a rotation in 3 dimensions
I don't know yet WHAT is a (the?) quaternion of a 3Drotation:
could you suggest to me a comprehensive web info site on that subject? (I am a Maths teacher)

2'- in Celx , is this quaternion a frame dependant representation of a rotation? (frame relative coordinates) or is it an implicitly 'universal frame' description

3-
Finally is there a
Celestia:newposition (x,y,z) class method?
Yes, with exactly that name (except for the capital C)

I am completely new to Celx and Lua (but not in Object language programming: Smalltalk):
I would like to know WHICH methods ( EXHAUSTIVE list ?) of Lua are understood in Celx Scripts except those already mentionned in your 'Summary of Lua-support in Celestia (Version 1.0)'

4-more important, I don't know what are the interactions between Lua language, celx language, script implementation in Celestia, the Celestia software itself and the Celestia executable program...
Could you tell me where to read on that matter..

Thanks
JPierre

Re: positionnig/viewing in Celx:help?

Posted: 24.04.2004, 13:16
by Harry
Rjp buisson wrote:I don't know yet WHAT is a (the?) quaternion of a 3Drotation:
could you suggest to me a comprehensive web info site on that subject? (I am a Maths teacher)
I don't fully understand quaternions either, but google finds some nice websites for this.
2'- in Celx , is this quaternion a frame dependant representation of a rotation? (frame relative coordinates) or is it an implicitly 'universal frame' description
AFAIK a quaternion is only a rotation, which doesn't really care about frames of reference. Only if used as an orientation, a frame is needed: IIRC "up" for an observer is computed by applying the rotation you get using observer:getorientation() to the vector (0,1,0), and there obviously must be some frame of reference for this vector to be defined in. For Celx, this frame for the get-/setorientation methods is the universal frame, so you could say orientations/rotations are used in universal frame.
(I hope this is correct, please everybody feel free to post corrections or further explanations)
I would like to know WHICH methods ( EXHAUSTIVE list ?) of Lua are understood in Celx Scripts except those already mentionned in your 'Summary of Lua-support in Celestia (Version 1.0)'
I will try to post an updated version later...
4-more important, I don't know what are the interactions between Lua language, celx language, script implementation in Celestia, the Celestia software itself and the Celestia executable program...
Could you tell me where to read on that matter..

Lua is a programming language and a interpreter which can be embedded into other applicatons (like Celestia). Of course simply embedding it would be of no use, because then the Lua-interpreter would not be able to influence Celestia. So some glue has to be provided, and this glue is what I describe in my summary - it's like a library which provides Celestia-related methods (and "classes") to the Lua-scripts. So CELX is Lua with the Celestia-specific extensions.
The Celestia sources can be compiled either with our without including the Lua-interpreter. All recent official Celestia-builds come with Lua/CELX included, but there may still be a number of people building it without (most probable scenario is building it on a Linux Systems which doesn't have the lua-libraries installed).

Harald