Distances in Celestial browser screwed up
Posted: 30.07.2002, 07:32
Hi,
First of all, great program!!
I found the following bug though (running celestia 1.2.4 on Linux, graph.
card irrelevant as you will see...).
If you get the list of nearest stars in the celestial browser, it seems to
be screwed up completely. I suppose that when you are hovering over
the Earth, the nearest star should be Sol, then Proxima Centauri,
etc. but it usually gives a star some 250-odd lightyears away...
If you empty the start.cel script (i.e. no movement at startup), the list
shows up correctly as long as you don't move yet, so it seems to be a
problem with wrongly updating the observer's position for some
circumstances. Then I started digging deeper in the code to see what
could be the problem.
Now, I'm afraid I'm opening a can of worms here, because I couldn't
get the units of the several variables right...
If I understand correctly, you have the following:
Observer::getPosition() -> 3D vector position in lightyears,
Observer::getVelocity() -> 3D vector velocity in microlightyears/s,
dt -> seconds (see getTime)
transform.translation -> same as getPosition() (is assigned to it)
I started printing out the observer position while the simulation was
running. When going from the initial position (observer position 0,0,0)
to Sol, the x coordinate went from 0 to 3254 ly, although initially Sol
was only 206 AU away. So here already there is something wrong
in the observer position kept internally in the program.
Further, there is a formula in Simulation::update:
transform.translation = transform.translation + observer.getVelocity() * dt
which works out as ly = ly + microly/s * s ???
Could this be the source of the problem ? I'll keep looking further, but
I guess other people here can pinpoint the problem much quicker.
First of all, great program!!
I found the following bug though (running celestia 1.2.4 on Linux, graph.
card irrelevant as you will see...).
If you get the list of nearest stars in the celestial browser, it seems to
be screwed up completely. I suppose that when you are hovering over
the Earth, the nearest star should be Sol, then Proxima Centauri,
etc. but it usually gives a star some 250-odd lightyears away...
If you empty the start.cel script (i.e. no movement at startup), the list
shows up correctly as long as you don't move yet, so it seems to be a
problem with wrongly updating the observer's position for some
circumstances. Then I started digging deeper in the code to see what
could be the problem.
Now, I'm afraid I'm opening a can of worms here, because I couldn't
get the units of the several variables right...
If I understand correctly, you have the following:
Observer::getPosition() -> 3D vector position in lightyears,
Observer::getVelocity() -> 3D vector velocity in microlightyears/s,
dt -> seconds (see getTime)
transform.translation -> same as getPosition() (is assigned to it)
I started printing out the observer position while the simulation was
running. When going from the initial position (observer position 0,0,0)
to Sol, the x coordinate went from 0 to 3254 ly, although initially Sol
was only 206 AU away. So here already there is something wrong
in the observer position kept internally in the program.
Further, there is a formula in Simulation::update:
transform.translation = transform.translation + observer.getVelocity() * dt
which works out as ly = ly + microly/s * s ???
Could this be the source of the problem ? I'll keep looking further, but
I guess other people here can pinpoint the problem much quicker.