Hi all,
I have the following question:
Is it possible to use Celestia and via a script or addon, to get a list of stars inside a radius of x lightyears around the currently selected object and highlight them, say with a colored reticule or something?
An example would be the following: Select a star, say Sirius, and then run the script in order to highlight all the stars in a 200ly radius. I understand that would mean a hell lot of stars (~200^3/3^3~10^5 in this case), but perhaps one could add further criteria like star type or brightness etc.
So, is this possible? BTW, I know that going to Navigation > Star Browser, I can do something similar, but it is not exactly what I want, ie to highlight them all at the same time. From a quick search that I did, I didn't find anything helpful.
An idea would be to do the selection and calculation a priori in some other program and then modify Celestia's star catalog to contain only these stars, but it would be nice to do it in real time.
Thanks for any pointers/help!
Cheers
How to get a list of stars around some target?
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
-
Topic authorcaptain_picard
- Posts: 6
- Joined: 11.08.2010
- With us: 14 years 3 months
Re: How to get a list of stars around some target?
Hi,
Have a look here
http://en.wikibooks.org/wiki/Celestia/C ... stia#stars
In the given example stars are selected by spectral type but you can choose the distance from a target or any creterion you want.
Have a look here
http://en.wikibooks.org/wiki/Celestia/C ... stia#stars
In the given example stars are selected by spectral type but you can choose the distance from a target or any creterion you want.
-
Topic authorcaptain_picard
- Posts: 6
- Joined: 11.08.2010
- With us: 14 years 3 months
Re: How to get a list of stars around some target?
Awesome!!! It seems to be exactly what I am looking for!!! Many thanks dude
Cheers
Cheers
- Marco Klunder
- Posts: 181
- Joined: 20.02.2008
- Age: 62
- With us: 16 years 9 months
- Location: The Netherlands
Re: How to get a list of stars around some target?
Although already cross-posted by Jogad, here is an example code to mark stars from the actual selected star within a given distance of 100 LY
You can of course adjust the distance.
Marco
You can of course adjust the distance.
Code: Select all
obs = celestia:getobserver()
obs:setframe(celestia:newframe("universal"))
celestia:unmarkall()
celestia:setrenderflags{markers = true}
-- Set distance in Lightyears
distance = 100
i=0
number_of_stars = celestia:getstarcount()
actual_selection = celestia:getselection()
if actual_selection:type() == "star" then
pos_actual_star = actual_selection:getposition()
for star in celestia:stars() do
distance_to = pos_actual_star:distanceto(star:getposition()) / 9460730472580.8
if distance_to <= distance then
label_string = string.format("%4.1f", distance_to)
star:mark("gold" , "square", 4, 1, "" .. label_string, false)
end
i=i+1
if math.fmod (i, 1000) == 0 then
celestia:print("Starcount: " .. i .. " of total: " .. number_of_stars, 10, -1, -1, 2, 4)
wait(0)
end
end
celestia:print("Stars marked with distance to " .. actual_selection:name() .. " < " .. distance .. " LY.", 10.0, -1, -1, 2, 4)
wait(10.0)
else
celestia:print("Actual selection is NOT a star", 3.0, -1, -1, 2, 4)
wait(3.0)
end
Marco
Last edited by Marco Klunder on 09.02.2013, 22:39, edited 2 times in total.
Marco Klunder
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
-
Topic authorcaptain_picard
- Posts: 6
- Joined: 11.08.2010
- With us: 14 years 3 months
Re: How to get a list of stars around some target?
Many thanks dude, you rock!!!!
I will give it a try asap
Cheers
I will give it a try asap
Cheers
- Marco Klunder
- Posts: 181
- Joined: 20.02.2008
- Age: 62
- With us: 16 years 9 months
- Location: The Netherlands
Re: How to get a list of stars around some target?
Small edits to the code in the above post.
Because the script was far, FAR, FAR to slow....
Marco
Because the script was far, FAR, FAR to slow....
Marco
Marco Klunder
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
-
Topic authorcaptain_picard
- Posts: 6
- Joined: 11.08.2010
- With us: 14 years 3 months
Re: How to get a list of stars around some target?
Thanks for the update on the script! I have just tried it and it works beautifully
Cheers
Cheers