Page 1 of 1

Making an exact interstellar structure

Posted: 07.04.2008, 02:05
by Arenamontanus
I'm trying to represent the universe of the venerable hard sf rpg 2300AD in Celestia. The game used the Gliese catalogue (2nd ed, 1969) for star positions and a nontrivial "geography" of possible travel routes (due to distance-limited FTL). After a weekend of hacking I have some rather appealing results (link1, link2):
Image

The travel routes are right now prisms my Matlab software writes to a cmod file. This gives them a very cool 3D feel, but I'm pretty certain there ought to be a simpler way of connecting the dots! Is there a way of creating a user-defined "constellation" that links the right stars? Or a script method to add the proper lines?

In lieu of that, I must clearly get the coordinate transformations just right. I have a database of star positions (which includes stars with incorrect positions that must be retained for the game assumptions - the game is not only an alternate timeline today but an alternate interstellar geography!). Right now my stars and my routes do not align as they should. The star positions are stored in a simple xyz coordinate system that I convert to RA,Dec with little problem. The nebula object that contains the routes uses the original xyz coordinates. After some mental rotation I managed to get the right 90 degree rotation, but the stars I add do not align with the corners. The difference seems to be a few degrees. I have a nagging suspicion that this is due to a different epoch. Any ideas?

{Original Ra, Dec data in 1969 epoch} -> [spherical to cartesian] -> {XYZ coordinates I have} -> [cartesian to spherical] -> {Ra,Dec,Dist in .stc file (interpreted in current epoch)} -> Celestia
(The positions are a bit off compared to the real positions due to changed epoch, but since I do not care for the real stars in this application this is not a problem.)

{XYZ as above} -> [90 degree rotation of axes] -> {.cmod xyz coordinates} -> Celestia

(If I have a star at location (1,0,0) it ought to end up at Dec: 0, Ra: 0, Dist: 1 and my mesh ought to point at this spot too since I do not rotate it)

Overall, if this approach turns out to be stupid, what would be the best way of creating a 3d object that touches exact spherical coordinates in interstellar space? Or conversely, how to get stars to touch the right locations in a multi-lightyear 3d object?

Re: Making an exact interstellar structure

Posted: 07.04.2008, 05:05
by Reiko
You can use asterisms which are the same thing the lines in the constellations are. They are very easy to place but the trade off is you no longer have the constellations to look at and you can only use one color.

Re: Making an exact interstellar structure

Posted: 07.04.2008, 09:34
by selden
A discussion of coloring constllation lines is available in the topic Activate only one Constelation.

You may also find some useful information in Lines between stars or fictional planet systems ;)

Re: Making an exact interstellar structure

Posted: 07.04.2008, 10:58
by Arenamontanus
Thanks! I should have guessed this is an old question.

Great, now I think I have two options and can go for the simplest/best looking (asterisms are simple, cmod allows me texturing). As soon as I hit the bed after writing my post I immediately realized where the epoch problem was; my cmod object is of course oriented according to the current epoch! I spent the rest of the night dreaming about rotating coordinate systems.

Re: Making an exact interstellar structure

Posted: 07.04.2008, 19:03
by chris
Arenamontanus wrote:Thanks! I should have guessed this is an old question.

Great, now I think I have two options and can go for the simplest/best looking (asterisms are simple, cmod allows me texturing). As soon as I hit the bed after writing my post I immediately realized where the epoch problem was; my cmod object is of course oriented according to the current epoch! I spent the rest of the night dreaming about rotating coordinate systems.

Your cmod map looks very nice. It seems worth pursuing even though it takes more work than the asterisms approach. Did precessing the star coordinates to J2000 solve the problem?

--Chris

Re: Making an exact interstellar structure

Posted: 08.04.2008, 10:29
by Arenamontanus
chris wrote:Your cmod map looks very nice. It seems worth pursuing even though it takes more work than the asterisms approach. Did precessing the star coordinates to J2000 solve the problem?

Thanks! Unfortunately precessing the coordinates did not work. Perhaps I used the wrong formula (anybody have a good pointer to another implementation so I can double-check?), but the discrepancy still seems to be a bit larger than precession could explain - a few degrees. Most annoying.

I'm letting that subproblem rest for the moment while I try to cross-index the Gliese catalogue with the HIP numbers. However, given how nice the cmod connections looked with texture maps I will definitely not give up on them.

Re: Making an exact interstellar structure

Posted: 08.04.2008, 11:09
by selden
You might take a look at the algorithms used in RAL's Starlink library
http://star-www.rl.ac.uk/store/store.html
C and Fortran source codes are available.

Re: Making an exact interstellar structure

Posted: 08.04.2008, 19:09
by Reiko
Since you do not mind the extra work involved then yes cmods are your best bet. I do have a question, how you make the lines thicker?

Re: Making an exact interstellar structure

Posted: 09.04.2008, 18:16
by Arenamontanus
You mean, how do I make the connecting prisms thick prisms? Since I calculate them beforehand, I can use vector algebra:

If X1 and X2 are the positions of the two stars, then D=(X2-X1) is the vector that connects them. I chose an arbitrary vector A=<1,0,0> and calculate the cross product with D and normalize: R=AxD/|AxD| (if we are really unlucky AxD=0, in that case just choose another A). R is orthogonal to D and of unit length. Now I calculate a vector U=RxD/|RxD| which is orthogonal to the other two. Now I can use this to calculate a cylinder (or, since I only use a few points on it, a prism). For points at the X1 end the locations will be X = X1 + r*(cos(theta)*R + sin(theta)*U) where r is the thickness and theta goes around the rim of the cylinder. For the X2 end the locations are X = X2 + r*(cos(theta)*R + sin(theta)*U).

This is just a few lines of code in Matlab, the cmod file output code is messier since I need to keep track of which vertex has which number.

Re: Making an exact interstellar structure

Posted: 25.04.2008, 22:06
by eburacum45
I have had a little time to test your add-on, Anders, (thanks for that) and although I like the appearance of the cmod travel routes, they do slow my computer down considerably. I would recommend using asterisms for the same purpose- note that they need not be exlusive of each other, and you could switch from one to another by selecting to display nebulas or constellations.

Re: Making an exact interstellar structure

Posted: 01.05.2008, 01:28
by Arenamontanus
eburacum45 wrote:I have had a little time to test your add-on, Anders, (thanks for that) and although I like the appearance of the cmod travel routes, they do slow my computer down considerably. I would recommend using asterisms for the same purpose- note that they need not be exlusive of each other, and you could switch from one to another by selecting to display nebulas or constellations.

Yes, that makes sense. I know I can optimize the cmod quite a bit by doing triangle strips (at the price of having to think a bit in my code), but the "nebula" can be distracting on its own too. I'll add this optionality in my 2.0 version.

Thanks for your useful comments!