Re: [Celestia-developers] New reference mark code
Real-time 3D visualization of space
Status: Beta
Brought to you by:
cjlaurel
From: Chris L. <cl...@gm...> - 2008-04-09 01:40:25
|
Case #2 is what Celestia does now. I suppose you could argue that it's physically meaningless, but it's not mathematically meaningless: if the speed of light were infinite, the arrow would be pointing in the right place. An infinite speed of light is assumed throughout Celestia right now, so I don't think that it's inappropriate for the direction arrows to behave as they currently do. When we want to incorporate light time delay globally into Celestia, we can fix up the reference marks too. If there's some pressing reason to make arrows point in the apparent direction of an object (assuming a finite speed of light), it's not that hard to add a flag to do it. As to the matter of incorporating light time delay into Celestia, it's not that difficult to do conceptually. In fact, if anyone's interested, I can provide a patch which accounts for the finite speed of light when positioning objects. Some things such as eclipse shadows are not corrected for light time delay, but that basics are in place. The big problem is that a lot of extra calculation is required. The VSOP87 orbits are very expensive to evaluate. Without light time, you only need to evaluate the VSOP87 series for each planet once per frame rendered; when computing light time delay, you may have to evaluate them /many/ times per frame. To calculate the position of an object corrected for light time, it's usually sufficient to calculate the position of the object at the observer's time, compute the viewer-to-object distance, multiply by c to get the delay, then recalculate the position at the observer's time minus the delay. (Iterating more that once gives more accurate results, but there are usually other sources of error that make this not worthwhile.) Now doubling the amount of work isn't so bad; however, we need to know the positions of a planet's moons, too. In calculating these, we'll have to reevaluate the planet's position at slightly different times for each moon, since each will be at a slightly different distance from the observer. Some of the new culling code in 1.6.0 reduces the amount of calculation, but there can still be a lot of it. Also, it's not as bad when using table based ephemerides for the planets such as SPICE kernels or the DE405--these are /much/ faster to evaluate than VSOP87. --Chris On Mon, Apr 7, 2008 at 3:24 AM, Selden E Ball Jr <se...@le...> wrote: > I just realized: the body-to-body vector is not so simple. > > The body to body direction vector probably needs to display 3 different > orientations, two of which correspond to the light delay between > the objects. > > 1. pointing toward where the target appears to be > 2. pointing toward where the target "is" > ( presumably this is what it does now, but which might be considered > to be physically meaningless) > 3. pointing toward where the target will be > (i.e. the direction in which to point an antenna in order for its > signal to be in the correct location at the target when the > signal arrives there.) > > Presumably case #1 should happen when one enables the exising light > delay command. > > I dunno how one should enable case #3. > > s. > > > > > The following patch adds the object:addreferencemark/removereferencemark > > methods to celx scripting: > > http://vincent.gian.club.fr/celestia/refmark.patch > > > The addreferencemark method take a single table argument which accepts the > > following keys: type, size, opacity, color and target. Except type, all > > other keys are optional. If not precised, optional keys keep their default > > values set in axisarrow.cpp. The available keys depends on the type: > > http://vincent.gian.club.fr/celestia/refmarkkeys.jpg > > > The following example adds a blue arrow from Earth to Mars, with a size > > of 5000 km from Earth's surface, and then removes it: > > > earth = celestia:find("Sol/Earth") > > mars = celestia:find("Sol/Mars") > > > earth:addreferencemark{type = "body to body direction", size = 5000, color = > > "blue", target = mars} > > wait(5) > > earth:removereferencemark("body to body direction") > > > > This patch also adds support to set the colors of the planetographic grid > > elements via the celestia:setlinecolor/setlabelcolor methods. > > > Example: > > > earth = celestia:find("Sol/Earth") > > > celestia:setlinecolor("planetographicgrid", 0.35, 0.35, 0) > > celestia:setlinecolor("planetequator", 0.6, 0.5, 0) > > celestia:setlabelcolor("planetographicgrid", 0.5, 0.5, 0) > > > earth:addreferencemark{type = "planetographic grid"} > > > > The patch at last changes "frame center arrow" into "frame center direction" > > in celestiacore.cpp and in the qt4 front-end. > > > > @+ > > Vincent > > > > > > > > > Selon vincent <vin...@fr...>: > > > > Chris, > > > > > > Thanks for pointing this out. I had just found the new phase object > > > in celx.cpp along with the detailed comments. I'll remove the > > > "frame center arrow" type. > > > > > > I've also added two new keys: opacity which applies specifically to axis > > > reference marks and color which applies only to arrow reference marks. > > > > > > Then, it would be great to add the setColor option to the planetgrid too... > > > > > > > > > > Yes, it would be good to keep these names consistent. Body to body > > > > direction should be used instead of body to body arrow. > > > > > > For consistency, shouldn't we also change "frame center arrow" into > > > "frame center direction" in celestiacore.cpp ? > > > > > > > > > @+ > > > Vincent > > > > > > > > > Selon Chris Laurel <cl...@gm...>: > > > > > > > There actually is a way to do this in Celestia 1.6.0. I implemented a > > > > new object type called phase. It's documented on the Wikibook (though > > > > I just now linked in the page on the phase object): > > > > > > > > http://en.wikibooks.org/wiki/Celestia/Celx_Scripting/CELX_Lua_Methods > > > > > > > > In Celestia 1.6.0, an object can have multiple reference frames: only > > > > a single orbit frame and body frame at any given instant, but the > > > > frame may change over the life of the object. This is represented in > > > > Celestia as a timeline with multiple phases. Each timeline phase has > > > > an orbit, rotation model, orbit frame, body frame, and span. To get > > > > the phase of an object active at a given time, use getphase: > > > > > > > > phase = obj:getphase(now) > > > > > > > > Then, you can get the orbit frame: > > > > > > > > frame = phase:orbitframe() > > > > > > > > And then the center object: > > > > > > > > center = frame:getrefobject() > > > > > > > > Now that the same frames are positioning and orienting the observer > > > > and solar system objects, it probably makes sense to rename the > > > > getrefobject method to center (or create a synonym, since renaming it > > > > would break existing scripts.) > > > > > > > > When implementing new celx methods, I've been adding detailed Doxygen > > > > comments in the code, complete with example usages. I basically just > > > > copy these descriptions to the Wikibook once I submit the code to SVN. > > > > > > > > --Chris > > > > > > > > On Sun, Apr 6, 2008 at 1:31 PM, vincent <vin...@fr...> wrote: > > > > > Chris Laurel wrote: > > > > > > > > > > > I think that it should be an absolute value in kilometers. There are > > > > > > cases when it would be useful to have frame axes shown for a reference > > > > > > point, and it's not generally clear what the radius of a reference > > > > > > point. > > > > > > > > > > OK, I'll change that. > > > > > > > > > > > > > > > > > > > > > Frame center direction is really a special case of body to body > > > > > > direction; I don't think it needs to be a separate reference mark > > > type. > > > > > > > > > > I made it a separate case because I'm not aware of a method to return > > > > > the orbit frame center. Does such a method exist in celx ? > > > > > > > > > > > > > > > @+ > > > > > Vincent > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Sun, Mar 30, 2008 at 5:38 AM, vincent <vin...@fr...> > > > > wrote: > > > > > > > > > Chris, > > > > > > > > > > > > > > > > > > I've made the changes you suggested to the > > > > object:addreferencemark > > > > > > method. > > > > > > > > > It now takes a table as argument. So far, this tables accepts > > > 3 > > > > keys > > > > > > which > > > > > > > > > are type, size and target. Setting the type works correctly > > > both > > > > with > > > > > > > > > > > > > > > > > > t = {} > > > > > > > > > t.type = "body axes" > > > > > > > > > earth:addreferencemark(t) > > > > > > > > > > > > > > > > > > and > > > > > > > > > > > > > > > > > > earth:addreferencemark{type = "body axes"} > > > > > > > > > > > > > > > > > > Then, it looks like nothing in the current code allows to set > > > > the > > > > > > size of > > > > > > > > > the reference mark. Are you planning to implement this soon? I > > > > can > > > > > > give it > > > > > > > > > a try, but it will take its time since I'm not familiar yet > > > with > > > > the > > > > > > > > recent > > > > > > > > > reference mark implementation. > > > > > > > > > > > > > > > > > > @+ > > > > > > > > > Vincent > > > > > > > > > > > > > > > > > > > > > > > > > > > Selon Chris Laurel <cl...@gm...>: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 24, 2008 at 1:06 PM, vincent > > > <vin...@fr...> > > > > > > wrote: > > > > > > > > > > > Chris Laurel wrote: > > > > > > > > > > > > > > > > > > > > > > > Ideally, one could use the addreferencemark script > > > > command to > > > > > > > > > > > > set the properties of a reference mark, such as the > > > size > > > > for > > > > > > axes > > > > > > > > and > > > > > > > > > > > > arrows. Thus, I think it would be best to make the > > > > argument to > > > > > > > > > > > > addreferencemark a table. I'd like to be able to write > > > > code > > > > > > like > > > > > > > > this: > > > > > > > > > > > > > > > > > > > > > > > > earth = celestia:find("Sol/Earth") > > > > > > > > > > > > earth:addreferencemark{ type = "body axes", size = > > > 20000 > > > > } > > > > > > > > > > > > > > > > > > > > > > That sounds good to me. One suggestion, though: what you > > > > wrote > > > > > > > > > > > looks more like the CEL scripting terminology. So far, in > > > > CELX > > > > > > > > > > > scripting, arguments were implicitely defined, such as: > > > > > > > > > > > object:mark( "red", "circle", 70, 0.5) > > > > > > > > > > > > > > > > > > > > > > So I would just suggest using something like: > > > > > > > > > > > earth:addreferencemark{"body axes", 20000} > > > > > > > > > > > > > > > > > > > > There are several existing commands in celx that accept > > > table > > > > > > > > > > parameters and thus named arguments. One example is the > > > table > > > > form > > > > > > of > > > > > > > > > > goto: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://en.wikibooks.org/wiki/Celestia/Celx_Scripting/CELX_Lua_Methods/Celx_observer#goto > > > > > > > > > > > > > > > > > > > > (And forgive me if you're already very familiar with this . > > > . > > > > .) > > > > > > The > > > > > > > > > > table form allows you to write either: > > > > > > > > > > > > > > > > > > > > t = {} > > > > > > > > > > t.type = "body axes" > > > > > > > > > > t.size = 20000 > > > > > > > > > > earth:addreferencemark(t) > > > > > > > > > > > > > > > > > > > > or, via some "syntactic sugar" in the Lua language: > > > > > > > > > > > > > > > > > > > > earth:addreferencemark{type = "body axes", size = 20000} > > > > > > > > > > > > > > > > > > > > Thus, in Lua we have the option of defining functions that > > > > accept > > > > > > > > > > either a plain old parameter list or named parameters. When > > > > there > > > > > > are > > > > > > > > > > a lot of possible parameters and many of these parameters > > > have > > > > > > > > > > sensible defaults, the named parameter list can be clearer. > > > > And > > > > > > with > > > > > > > > > > reference marks, not all properties are relevant for all > > > > reference > > > > > > > > > > mark types. For instance, the body-to-body direction arrow > > > > lets you > > > > > > > > > > specify any object to point to. There's no equivalent for > > > > other > > > > > > > > > > reference mark types. Named parameters are a good way of > > > > handling > > > > > > this > > > > > > > > > > heterogeneity without having to introduce a new reference > > > mark > > > > > > object > > > > > > > > > > type. > > > > > > > > > > > > > > > > > > > > So, to add an arrow pointing from Earth to the moon, you > > > might > > > > do > > > > > > this: > > > > > > > > > > > > > > > > > > > > earth:addreferencemark{type = "body to body arrow", target = > > > > > > > > > > celestia:find("Sol/Earth/Moon") } > > > > > > > > > > > > > > > > > > > > (Here, the default size of 2x the planet radius is used, > > > > showing a > > > > > > > > > > convenient of named parameter lists.) > > > > > > > > > > > > > > > > > > > > --Chris > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > @+ > > > > > > > Vincent > > > > > > > > > > > > > > > > > > > > > > > > > > > > @+ > > > > > Vincent > > > > > > > > > > > > > > > > > > @+ > > > Vincent > > > > > > > @+ > > Vincent > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > > Register now and save $200. Hurry, offer ends at 11:59 p.m., > > Monday, April 7! Use priority code J8TLD2. > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > > _______________________________________________ > > Celestia-developers mailing list > > Cel...@li... > > https://lists.sourceforge.net/lists/listinfo/celestia-developers > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Register now and save $200. Hurry, offer ends at 11:59 p.m., > Monday, April 7! Use priority code J8TLD2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > > _______________________________________________ > Celestia-developers mailing list > Cel...@li... > https://lists.sourceforge.net/lists/listinfo/celestia-developers > |