Manually editing vertex coordinates

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.
Topic author
even_better
Posts: 2
Joined: 29.01.2012
With us: 12 years 9 months

Manually editing vertex coordinates

Post #1by even_better » 03.02.2012, 20:25

I’m interested in creating a star map with lines between stars. Nothing too fancy, it’s just for my own benefit so I can see it in 3D. I’ve gotten ahold of Selden’s mod for Downbelow Station (http://www.lepp.cornell.edu/~seb/celestia/pell/index.html) and Reiko’s Star Trek trade routes (http://www.shatters.net/forum/viewtopic.php?t=11653). When I try to edit them, however, I find that the vertex coordinates I use for stars are way, way off. I’ve been using Harry’s coordinate script (http://www.shatters.net/forum/viewtopic.php?f=9&t=4147) and Cham’s conversion formula (http://www.shatters.net/forum/viewtopic.php?f=2&t=11542&start=15), both of which give different results and neither of which match up to what was in the CMOD codes. What stellar coordinates are used in CMODs and how can I find them?

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

Re: Manually editing vertex coordinates

Post #2by selden » 03.02.2012, 21:00

The CMOD coordinates have to be provided in Celestia's internal xyz coordinate system, which is related to the ecliptic coordinate system, not equatorial (I.E. not in RA & Dec).

Here's the fortran subroutine that I use.

Code: Select all

   subroutine radec2xyz (ra,dec,r, x,y,z)

   implicit double precision (a-z)

c       degrees-to-radians conversion factor
   d2r = 6.283185307179586476925287D0/360.0d0

c       compensate for J2000 obliquity of the ecliptic
c       source: celestia source code
   eps = 23.4392911d0*d2r

c       translate RA & Dec to phi and theta
   phi = d2r* (ra+90.0d0)
   theta = d2r* (dec)

c       initlal translation to rectangular coordinates
   x1 = r*COS(phi) * COS(theta)
        y1 = r*SIN(phi) * COS(theta)
        z1 = r*(-SIN(theta))

c       change axes to match Celestia's ecliptic coordinates
   x0 =  y1
   y0 = -z1
   z0 =  x1

c       rotate to ecliptic coordinates
   x =  x0
   y = +y0*cos(eps)+z0*sin(eps)
   z = -y0*sin(eps)+z0*cos(eps)

   return
   end


p.s. the purpose of the routine is to convert RA (in degrees), Dec (in degrees) and r (distance in LY) to Celestia's internal x,y and z "ecliptic" coordinates (in LY).
Selden

Topic author
even_better
Posts: 2
Joined: 29.01.2012
With us: 12 years 9 months

Re: Manually editing vertex coordinates

Post #3by even_better » 04.02.2012, 20:47

How do I utilize this? What software do I need to feed this into?

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

Re: Manually editing vertex coordinates

Post #4by selden » 05.02.2012, 12:21

The implementation above is a Fortran subroutine which translates RA, Dec and Distance values into Celestia's internal xyz coordinates. It's the "kernel" of a larger Fortran 77 program that I use to generate the CMOD of Alliance/Union trade routes. My hope was that you could translate the algorithm that it implements into whatever process you are using. I'm not pretending that this is the only algorithm that would work, but it does produce the correct results for me. It's not particularly efficient, but it doesn't have to be, since (for me) it only has to generate a model containing fewer than 40 end points.

If you want, I could provide the full program and the input dataset that I use, although they'll need significant modifications in order to produce a CMOD of routes for other polities. As I use it, it requires Cygwin ( http://www.cygwin.com ) under Windows, including Cygwin's optional g77 and its prerequisites. It'll probably work with gfortran, but I haven't bothered to ensure that compatibility.
Selden


Return to “Help Central”