Exact Measurements in Celestia

Have a question about using Celestia? Check here first for FAQs and helpful advice.
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.
Avatar
Topic author
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 40
With us: 20 years 2 months
Location: MinneSNOWta
Contact:

Exact Measurements in Celestia

Post #1by PlutonianEmpire » 09.05.2009, 17:30

What are the all of the exact measurements used for Celestia?

Meaning, exactly how many kilometers is one AU, and exactly how many days is one year, and so forth?

I read the answer to those questions somewhere, but I forget where.
Terraformed Pluto: Now with New Horizons maps! :D

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: Exact Measurements in Celestia

Post #2by t00fri » 09.05.2009, 18:05

PlutonianEmpire wrote:What are the all of the exact measurements used for Celestia?

Meaning, exactly how many kilometers is one AU, and exactly how many days is one year, and so forth?

I read the answer to those questions somewhere, but I forget where.

One amazing implication is that after time run over centuries in Celestia, the planets are still at the right place in the sky...

Fridger
Image

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: Exact Measurements in Celestia

Post #3by selden » 09.05.2009, 19:17

The values can be found in Celestia's source code on SourceForge.
http://celestia.svn.sourceforge.net/vie ... estia/src/

Most of them are in either astro.h or astro.cpp

Here are a few:
src/celengine/astro.cpp:const double astro::speedOfLight = 299792.458; // km/s
src/celengine/astro.h:#define KM_PER_LY 9460730472580.8
src/celengine/astro.h:#define KM_PER_AU 149597870.7
src/celengine/astro.h:#define LY_PER_PARSEC 3.26167

For a long time Celestia was using this value:
src/celengine/astro.h:// #define OLD_KM_PER_LY 9466411842000.000

The number of days in a Terrestrial year is hardwired in the code in many places: 365.25

Fridger,

When writing Lua orbital and rotation routines, one needs to use exactly the same values as Celestia is using. Too often, they are not the same as what one finds when searching with Google. The number of kilometers in an AU is one example.
Selden

Avatar
Topic author
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 40
With us: 20 years 2 months
Location: MinneSNOWta
Contact:

Re: Exact Measurements in Celestia

Post #4by PlutonianEmpire » 09.05.2009, 19:49

Thank you! :D
Terraformed Pluto: Now with New Horizons maps! :D

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: Exact Measurements in Celestia

Post #5by t00fri » 09.05.2009, 22:25

selden wrote:
Fridger,

When writing Lua orbital and rotation routines, one needs to use exactly the same values as Celestia is using. Too often, they are not the same as what one finds when searching with Google. The number of kilometers in an AU is one example.

Selden,

I actually misunderstood the English of that question. Apart from that, it's always bad to take ones information about such things from Google, at least without knowing the author who wrote it...Fortunately, one still cannot write a PhD with Google ;-)

Fridger
Image

Avatar
Topic author
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 40
With us: 20 years 2 months
Location: MinneSNOWta
Contact:

Re: Exact Measurements in Celestia

Post #6by PlutonianEmpire » 25.07.2009, 17:35

Sorry for gravedigging, but...

selden wrote:The number of days in a Terrestrial year is hardwired in the code in many places: 365.25
"365.25," is that the exact number that celestia uses, or is it something slightly greater or slightly less? I've looked around, but couldn't find it.
Terraformed Pluto: Now with New Horizons maps! :D

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: Exact Measurements in Celestia

Post #7by selden » 25.07.2009, 18:02

What do you mean by "looked around"?
In Celestia's source code or somewhere else?

it's in many of Celestia source files.

$ grep 365.25 */*.cpp | more
celengine/astro.cpp: int64 d = (int64) floor((c - 122.1) / 365.25);
celengine/astro.cpp: int64 e = (int64) floor(365.25 * d);
celengine/astro.cpp: return (floor(365.25 * y) +
celengine/customorbit.cpp: return 365.25;
celengine/customorbit.cpp: m2 = jd19/365.2596407;
celengine/customorbit.cpp: double T = t / 365.25;
celengine/customorbit.cpp: double T = t / 365.25;
celengine/customorbit.cpp: double D = d / 365.25; // years
celengine/customorbit.cpp: t2 = t1 / 365.25;
celengine/customorbit.cpp: t3 = (t - 2433282.423) / 365.25 + 1950.0;
celengine/customorbit.cpp: t5 = t4 / 365.25;
celengine/customorbit.cpp: t8 = t6 / 365.25;
celengine/customorbit.cpp: t9 = (t - 2442000.5) / 365.25;
celengine/customorbit.cpp: double T = t / 365.25;
celengine/customorbit.cpp: double theta = degToRad(151.401 + 0.57806 * t
/ 365.25);
celengine/customorbit.cpp: return CreateJPLEphOrbit(JPLEph_Mercury, JPLEp
h_Sun, 0.2408 * 365.25, 6.0e7);
celengine/customorbit.cpp: return CreateJPLEphOrbit(JPLEph_Venus, JPLEp
h_Sun, 0.6152 * 365.25, 1.0e8);
and that's just the first page of grep's output....
Selden

Avatar
Topic author
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 40
With us: 20 years 2 months
Location: MinneSNOWta
Contact:

Re: Exact Measurements in Celestia

Post #8by PlutonianEmpire » 25.07.2009, 18:16

selden wrote:What do you mean by "looked around"?
In Celestia's source code or somewhere else?

it's in many of Celestia source files.

$ grep 365.25 */*.cpp | more
celengine/astro.cpp: int64 d = (int64) floor((c - 122.1) / 365.25);
celengine/astro.cpp: int64 e = (int64) floor(365.25 * d);
celengine/astro.cpp: return (floor(365.25 * y) +
celengine/customorbit.cpp: return 365.25;
celengine/customorbit.cpp: m2 = jd19/365.2596407;
celengine/customorbit.cpp: double T = t / 365.25;
celengine/customorbit.cpp: double T = t / 365.25;
celengine/customorbit.cpp: double D = d / 365.25; // years
celengine/customorbit.cpp: t2 = t1 / 365.25;
celengine/customorbit.cpp: t3 = (t - 2433282.423) / 365.25 + 1950.0;
celengine/customorbit.cpp: t5 = t4 / 365.25;
celengine/customorbit.cpp: t8 = t6 / 365.25;
celengine/customorbit.cpp: t9 = (t - 2442000.5) / 365.25;
celengine/customorbit.cpp: double T = t / 365.25;
celengine/customorbit.cpp: double theta = degToRad(151.401 + 0.57806 * t
/ 365.25);
celengine/customorbit.cpp: return CreateJPLEphOrbit(JPLEph_Mercury, JPLEp
h_Sun, 0.2408 * 365.25, 6.0e7);
celengine/customorbit.cpp: return CreateJPLEphOrbit(JPLEph_Venus, JPLEp
h_Sun, 0.6152 * 365.25, 1.0e8);
and that's just the first page of grep's output....
I looked around in files in that link you gave me. I was using "year" and "days" as the search term.

My apologies.
Terraformed Pluto: Now with New Horizons maps! :D

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Re: Exact Measurements in Celestia

Post #9by Chuft-Captain » 25.07.2009, 23:56

selden wrote:What do you mean by "looked around"?
In Celestia's source code or somewhere else?

it's in many of Celestia source files.
I worry that this literal value is hard-coded in so many places. Best practice would be to declare it once only (for example as days_in_year )and then use that variable/attribute in all these places.

I wonder if a re-factoring of this has ever been attempted?

CC
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

Avatar
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

Re: Exact Measurements in Celestia

Post #10by Hungry4info » 27.07.2009, 23:53

Chuft-Captain wrote:Best practice would be to declare it once only (for example as days_in_year )and then use that variable/attribute in all these places.

That would certainly make the value easier to modify later if the need ever arises.
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics


Return to “Help Central”