Marking SOL

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
sfo2phx
Posts: 7
Joined: 24.03.2006
With us: 18 years 8 months

Marking SOL

Post #1by sfo2phx » 22.08.2006, 05:16

If Celestia can already do this, indulge me because I haven't figured out how to do it.

I think it would be nice to be able to put a small brightly-colored crosshair marking Sol's location when you're "traveling," even if Sol itself is invisible. Can this be done? Or should it simply be filed away as an "enhancement suggestion" for future releases of Celestia?

The extrasolar star maps generated over at Extrasolar Skies allow you to do this, and it's great for getting your bearings.

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #2by Cham » 22.08.2006, 05:26

Yes, Celestia can do this. It's a standard procedure, actually. Use Ctrl-P to mark any selected object. If you want it permanent, you could add some command lines in the start.cel file, like this :

# script to mark all messier objects
mark { object "M1" size 20 color [ 0.0 0.5 0.5] symbol "square" }
mark { object "M2" size 20 color [ 0.0 0.5 0.5] symbol "square" }
mark { object "M3" size 20 color [ 0.0 0.5 0.5] symbol "square" }
... and so on ...

You have tons of options, here.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Topic author
sfo2phx
Posts: 7
Joined: 24.03.2006
With us: 18 years 8 months

Post #3by sfo2phx » 23.08.2006, 05:53

Coolness! Thanks!

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Post #4by fsgregs » 30.08.2006, 02:04

Cham:

In the script, what symbol shapes are available, beside "square"? Also, in the object statement, can it be anything being drawn in an ssc file? How do you point to it?

For example, are these correct statements???

mark { object "Sol" size 20 color [ 0.0 0.5 0.5] symbol "square" }
mark { object "HST" size 20 color [ 0.0 0.5 0.5] symbol "square" }, or would you have to state ...

mark { object "Sol/Earth/HST" size 20 color [ 0.0 0.5 0.5] symbol "square" }

:roll:

Thanks in advance

Frank

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #5by Cham » 30.08.2006, 02:14

I didn't tried it on an ssc object. I suspect it should work. Just try it, it should be easy to verify. I used that option to mark fictious solar systems, stars with real exoplanets, nebulae and Messier objects, and barycenters for multiple stars systems. The symbols you can use are these :

- x
- plus
- triangle
- diamond
- square
- probably simple symbols like "minus", "dot", or some others but I never tried.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #6by Vincent » 30.08.2006, 08:28

Frank, Cham,

Only these 5 symbols are available at the moment :
- x
- plus
- triangle
- diamond
- square

I've added the possibility to mark an object with an arrow in my own version. That was not an easy task because the size of the arrow must vary according to the size of the marked object... I got some quite satisfaying results. Here are some screenshots, with antialising disabled :

Image Image Image
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #7by phoenix » 30.08.2006, 15:28

this looks cool.
could you make a patch available? ;)
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #8by Cham » 30.08.2006, 17:38

I would prefer a scale independant arrow.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #9by Vincent » 30.08.2006, 18:13

Cham,

Sorry, I was not clear in my last post. The size of the arrow is of course independant from the marked object, and you can set it in the script :

Code: Select all

# Mark Earth with a size 20 red arrow...
mark { object "Sol/Earth" size 20 color [1 0 0] symbol "arrow" }

The point is that the arrow needed to be moved back on the left, with a distance that is relative to its own size (and so, that also depends on the object's size). So the gap is hardcoded : the arrow is drawn with an offset that is relative to its own size.

Another option would be to use an argument in the "mark" script function to set the gap (insted of having it hardcoded) :

Code: Select all

# Mark Earth with a size 20 red arrow, with a 40 pixels offset...
mark { object "Sol/Earth" size 20 color [1 0 0] symbol "arrow" offset 40}



phoenix,

Building a patch would be difficult since this feature belongs to one of my experimental versions of Celestia that includes a lot of changes... However, I'll be able to post the changes here quite soon...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #10by phoenix » 30.08.2006, 18:18

Vincent wrote: So the gap is hardcoded : the arrow is drawn with an offset that is relative to its own size.

yes, that's the part i'm really interested in.

phoenix,

Building a patch would be difficult since this feature belongs to one of my experimental versions of Celestia that includes a lot of changes... However, I'll be able to post the changes here quite soon...


thanks! I'm looking forward to see your changes ;)
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #11by Cham » 30.08.2006, 18:18

This is interesting. You should submit this to Chris, as I think we should have a little more markers options.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #12by Vincent » 30.08.2006, 22:19

Here are the changes :

.../src/celengine/marker.cpp (~ line 140 )

Code: Select all

    case Triangle:
        glBegin(GL_LINE_LOOP);
        glVertex3f(0.0f,  s, 0.0f);
        glVertex3f(   s, -s, 0.0f);
        glVertex3f(  -s, -s, 0.0f);
        glEnd();
        break;
       
// Add Arrow Marker - start - Vincent
    case Arrow:
        glBegin(GL_POLYGON);
        glVertex3f(-2*s-s, float(s/3), 0.0f);
        glVertex3f(-2*s-s, float(-s/3), 0.0f);
        glVertex3f(-s-s, float(-s/4), 0.0f);
        glVertex3f(-s-s, float(s/4), 0.0f);
        glEnd();
        glBegin(GL_POLYGON);
        glVertex3f(-s-s, float(2*s/3), 0.0f);
        glVertex3f(-s-s, float(-2*s/3), 0.0f);
        glVertex3f(-s, 0.0f, 0.0f);
        glEnd();
       break;
// Add Arrow Marker - end - Vincent
    }
}

.../src/celengine/marker.h (~ line 44 )

Code: Select all

    enum Symbol
    {
        Diamond  = 0,
        Triangle = 1,
        Square   = 2,
        Plus     = 3,
        X        = 4,
// Add Arrow Marker - start - Vincent
        Arrow = 5
// Add Arrow Marker - end - Vincent
    };

    Symbol getSymbol() const;
    void setSymbol(Symbol);

.../src/celengine/cmdparser.cpp (~ line 594 )

Code: Select all

            else if (compareIgnoringCase(symbolString, "x") == 0)
                symbol = Marker::X;
// Add Arrow Marker - start - Vincent
            else if (compareIgnoringCase(symbolString, "arrow") == 0)
                symbol = Marker::Arrow;
// Add Arrow Marker - end - Vincent
        }
       
        cmd = new CommandMark(object, color, (float) size, symbol);

.../src/celestia/celx.cpp (~ line 926 )

Code: Select all

    else if (compareIgnoringCase(name, "x") == 0)
        return Marker::X;
// Add Arrow Marker - start - Vincent
    else if (compareIgnoringCase(name, "arrow") == 0)
        return Marker::Arrow;
// Add Arrow Marker - end - Vincent
    else
        return Marker::Diamond;


Cham wrote:This is interesting. You should submit this to Chris, as I think we should have a little more markers options.

Well, I'm an "idea handyman" more than a coder :wink:... So I'm sure Chris could do this in a nicer way... Maybe later, because we all know he is working hard on other improvements, along with the other devs... Anyway, if the dev team is interested in it, they can of course use the idea and/or the piece of code for the official version.
Last edited by Vincent on 31.08.2006, 08:24, edited 1 time in total.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #13by chris » 30.08.2006, 22:35

Vincent wrote:Well, I'm an "idea handyman" more than a coder :wink:... So I'm sure Chris could do this in a nicer way... Maybe later, because we all know he is working hard on other improvements, along with the other devs... Anyway, if the dev team is interested in it, they can of course use the idea and/or the piece of code for the official version.


I think that this is worth adding. It might be nice to have arrows in several different directions: rightarrow, uparrow, etc.

Vincent, do you have a SourceForge account?

--Chris

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #14by Vincent » 31.08.2006, 08:41

Chris wrote:Vincent, do you have a SourceForge account?
Chris,
I use an anonymous account to update Celestia from the CVS, so I can't comit my changes for now.

Chris wrote:It might be nice to have arrows in several different directions: rightarrow, uparrow, etc.
I think I can work on it. I can also add the "offset" argument to the mark function if you prefer the "gap" to be set in the script, rather than keeping it hardcoded...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #15by Vincent » 31.08.2006, 11:14

Chris (and all other interested users...)

I've added the 4 types of arrows : leftarrow, uparrow, rightarrow and downarrow.

You can download a zip file including :
- a patch file built from the latest CVS version (updated 5 mn ago)
- a .exe file built from the latest CVS version modified with the patch
- a .cel script file to test the arrow markers feature
> http://vincent.gian.club.fr/celestia/ce ... arkers.zip

Here are some screenshots :
Image Image
Image Image
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #16by chris » 05.09.2006, 23:43

Thanks for this, Vincent. I'll check this change into CVS.

--Chris

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #17by Vincent » 06.09.2006, 11:46

You're welcome Chris.

Just one last thought... These arrows may diserve a bit of transparency. So what about adding an new alpha argument (0 = totally transparent , 1 = totally opaque) to the mark function ?

Code: Select all

mark { object "Sol/Earth"
   size 15
   color [0 1 0]
   alpha 0.7
   symbol "rightarrow" }

I had a look at the code, and I noticed that this would be applied to all types of markers. So, setting the alpha argument to the default value 1 would avoid breaking previous scripts/addons.

/EDIT/
The alpha value could also be declared as the 4th number of the color argument :

Code: Select all

mark { object "Sol/Earth"
   size 15
   color [0 1 0 0.7] # Red=0; Green=1; Blue=0; Alpha=0.7
   symbol "rightarrow" }
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #18by Vincent » 16.09.2006, 21:36

Hi,

I have added a new alpha argument to the mark function to set the transparency of the markers.
This argument can be used with all types of markers.
The alpha argument can have values from 0 (-> marker totally transparent) to 1 (-> marker totally opaque).
This works both in cel and celx scripts.

Here are some shots for alpha=0.9 (which is the value of transparency in the current CVS version ), alpha=0.7 and alpha=0.5.

Image

Image

Image

*****************************************************
IMHO, the arrow-marker looks better integrated into the background scene in the last 2 shots thanks to the transparency effect...
I can provide a new patch (from the last CVS) if you're interesting in this feature.
*****************************************************
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #19by Cham » 16.09.2006, 21:40

Is this code integrated in CVS right now ?

Can you also add an asterisk and a circle markers ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #20by phoenix » 16.09.2006, 22:13

Cham wrote:Is this code integrated in CVS right now ?


I don't think so.
But as chris said he was going to add this.
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)


Return to “Development”