nearest objects function

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Stormyman
Posts: 12
Joined: 01.06.2003
With us: 21 years 5 months

nearest objects function

Post #1by Stormyman » 01.08.2004, 01:00

Hi,

Would it be a big deal to create a function in the solar system browser that shows/selects the nearest objects to the current position ?
Similar to the star browser where on can make a list of the nearest stars.

It would be really cool if one could see a list of the nearest objects in general, indepedant from being a satellite, moon, asteroid,comet, planet or star.
Like if one is on the surface of earth something like 1. Earth 2. Hubble 3.ISS 4.Moon 5. Venus and so on :)

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

Re: nearest objects function

Post #2by Harry » 01.08.2004, 21:42

CELX is your friend here:
http://www.h-schmidt.net/celestia/show-nearest-objects_v1.0.celx

No nice UI, you still have to select manually, and it's not well tested (feel free to improve it).

Harald

symaski62
Posts: 610
Joined: 01.05.2004
Age: 41
With us: 20 years 6 months
Location: france, divion

Post #3by symaski62 » 01.08.2004, 22:58

8)

:oops: 5 mal


moi travailler


MLY_PER_AU = 149597870.7 / KM_PER_MICROLY

object_list = {}
object_list.n = 0

function append(list, obj)
list.n = list.n + 1
list[list.n] = obj
end

function fill_object_list(node)
append(object_list, node)
for i,v in ipairs(node:getchildren()) do
fill_object_list(v)
end
end

fill_object_list(celestia:find("Sol"))
distance_map = {}

function cmp_lt(obj1, obj2)
return distance_map[obj1] < distance_map[obj2]
end

function human_readable_dist(dist)
if dist > 0.1 * MLY_PER_AU then
return string.format("%4f au", dist/MLY_PER_AU)
else
return string.format("%4.1f km", dist*KM_PER_MICROLY)
end
end
while true do
obs = celestia:getobserver()
pos = obs:getposition()
for i,v in ipairs(object_list) do
distance_map[v] = pos:vectorto(v:getposition()):length()
end
table.sort(object_list, cmp_lt)
txt = ""
for i = 1, 10 do
txt = txt .. string.format("%i. %s (%s)\n", i, object_list[i]:name(), human_readable_dist(distance_map[object_list[i]]))
end
celestia:print(txt, 5, -1, 1, 2, -6)
wait(0.1)
end



8) 10 ? plus bien
windows 10 directX 12 version
celestia 1.7.0 64 bits
with a general handicap of 80% and it makes much d' efforts for the community and s' expimer, thank you d' to be understanding.


Return to “Development”