Page 1 of 1

howto draw lines with coordinates, relative any coord system

Posted: 10.01.2004, 16:17
by Rjp buisson
Hi . I am newbe here.
Three questions:
1) I want to draw lines between to points defined by their coordinates, using the current coordinate system(follow/lock/chase,etc..).
The idea is to "materialise"(visualize) particuliar alignements or even particular planes defined by objects of interest ,at a particular moment
(during an eclipse for exemple)
Is there a command for such a "drawline(A,B)" or "drawline(A,B,color)"...
It would be so usefull for educational purpose !
Can some one help me?

2) is there a command (function) which retrieves (return) the coordinates of any object, relative to the current coordinates system?

3) is there a command (or function) which displays on screen (or return )the coordinates of the observer, relative to the current coord. system?
Thank for your help

Re: howto draw lines with coordinates, relative any coord sy

Posted: 10.01.2004, 17:07
by Harry
Rjp buisson wrote:Is there a command for such a "drawline(A,B)" or "drawline(A,B,color)"...
Sorry, this isn't available. But I guess that would be a good feature...

Rjp buisson wrote:2) is there a command (function) which retrieves (return) the coordinates of any object, relative to the current coordinates system?

3) is there a command (or function) which displays on screen (or return )the coordinates of the observer, relative to the current coord. system?
Thank for your help

Lua-scripting can do that - so this is the position of the observer relative to the current frame-of-reference (retrieving positions of objects is similar):

Code: Select all

obs = celestia:getobserver()
pos = obs:getposition()
frame_of_reference = obs:getframe()
relative_pos = frame_of_reference:to(pos)
x = relative_pos:getx()
y = relative_pos:gety()
z = relative_pos:getz()
l = math.sqrt(x*x + y*y + z*z)
celestia:flash("x: "..x .. "\ny: ".. y .. "\nz: "..z.."\nlength: "..l, 100)

Copy this in a file ending with ".celx", and open it from celestia (version 1.3.1-1 needed).
The unit is microlightyears - multiply with 9466411.842 to get kilometers.

Harald

Re: howto draw lines with coordinates, relative any coord sy

Posted: 10.01.2004, 18:37
by Rjp buisson
Thanks Harry

[Is there a command for such a "drawline(A,B)" or "drawline(A,B,color)"?]
Sorry, this isn't available. But I guess that would be a good feature...
Yes indeed! Is there a way to "suggest" such implementations of "abstract graphic overlays " in Celestia to the Authors of Celestia? This would makes Celestia an extremely powerfull Educational tool, giving us comprehensive viewpoints,hints and representations, to the already exceptionnal rendering of the universe...

Lua-scripting can do that - so this is the position of the observer relative to the current frame-of-reference (retrieving positions of objects is similar):
[code]
obs = celestia:getobserver()
pos = obs:getposition()
frame_of_reference = obs:getframe()
relative_pos = frame_of_reference:to(pos)
x = relative_pos:getx()
...

Thanks a lot Harry!
I just discovered the Lua existence and the Summary of Lua-language you published on your site while I was awaiting an answer to my questions...
Great! You made a great job.
I sure will put my hands on That! It looks like a object oriented language, does'nt it?

Re: howto draw lines with coordinates, relative any coord sy

Posted: 10.01.2004, 20:14
by Harry
Rjp buisson wrote:Yes indeed! Is there a way to "suggest" such implementations of "abstract graphic overlays " in Celestia to the Authors of Celestia?

I think the best way would to ask about it in the celestia-forums. Errrr.... yes, just like you did.

Actually I wanted something similar for some time, but never really looked at the code needed for that. I will have a look at it when I am done with the stuff I currently work on, hoping someone else wrote it until then ;)

Harald