[Marble-devel] Reference system
marbledeveloper at gmail.com
Tue May 15 18:55:24 UTC 2012
First, I apologise because yesterday I was wrong to respond in the thread
with subject 'Reference system'. :) I'm so sorry.
I will try explain I've done step by step, Torsten helped me:
I have modified ViewportParamsPrivate::setPlanetAxis() method to use
another reference system to a specific kind of GeoDataCoordinates. In this
method I have implemented a lat-lon-Fixed-To-Inertial coordinate
conversion. This conversion uses the formula: v = s / t --> s = v * t. 'v'
is the earth angular speed and 't' is the time elapsed, for this reason I
need the marble clock.
1.- I have added an attribute in GeoDataCoordinatesPrivate class to set the
new type and I have added another attribute to set the marble clock. Code
for GeoDataCoordinates_p.h: http://pastebin.com/mCF0eLn7 The type indicates
the reference system to use for the GeoDataCoordinates object. By default
the value of the type is zero, this means that the reference system used is
the typical reference system used for Marble.
2.- Then I have modified the GeoDataCoordinates class to declare and
implement the get and set methods for the the new type and for the marble
clock. Code for GeoDataCoordinates.h: http://pastebin.com/pFF8hjGe and code
for GeoDataCoordinates.cpp: http://pastebin.com/BUGqVETW
3.- Later I have gone to the SphericalProjection class because the methods
in there are executed whenever geodetic coordinates converted to screen
coordinates. I have modified the method that has this prototipe: 'bool
SphericalProjection::screenCoordinates( const GeoDataCoordinates
&coordinates, const ViewportParams *viewport, qreal &x, qreal &y, bool
&globeHidesPoint ) const'. This is the new code for
4.- I have modified ViewportParamsPrivate::setPlanetAxis() method to use
another reference system to a specific kind of GeoDataCoordinates. Code:
1.- I'm not sure that the new implementation added in ViewportParams is
correct because the SphericalProjection::screenCoordinates() method doesn't
call ViewportParamsPrivate::setPlanetAxis() directly.
2012/5/13 Torsten Rahn <tackat at t-online.de>
> Now I get it :-)
> Yes, I can see why this kind of problem occurs with Orbit data.
> Right now we basically calculate the screen positions of objects for a
> position inside the projection classes. See
> with methods like
> bool SphericalProjection::screenCoordinates( const GeoDataCoordinates
> &coordinates, const ViewportParams *viewport,
> qreal &x, qreal &y, bool &globeHidesPoint ) const
> for example. The expensive part there is the line qpos.rotateAroundAxis(
> viewport->planetAxisMatrix() ) ); which does the basic coordinate
> transformation between geodetic GeoDataCoordinates and pixel coordinates.
> I guess that would be the proper place in the code where one could
> other such possible reference systems. If you really want to "save" CPU
> there then you'd probably introduce an alternative planetAxisMatrix that is
> used for the rotateAroundAxis method (have a look at the other places in
> code where the planetAxis is calculated to do this in a similar way).
> This would avoid having to "convert" the positions for all the
> GeoDataCoordinates of the Satellites. Instead you'd just create a fitting
> matrix once that would work for all :-)
> We'd gladly accept patches that do this in a nice way ;) This means it
> work for all projections with a nice API. Ideally you'd also provide some
> basic unit regression tests :)
> On Sonntag, 13. Mai 2012 13:20:14 marble_developer marble_developer wrote:
> > Hi,
> > I will try to explain it a bit better.
> > When the Earth turns the corresponding angle in each update of Marble
> > clock, the points added turn the same angle too, it's the normal
> > in Marble because the reference system rotates with the Earth globe.
> > In this case, a point that has the next values for lon, lat and alt
> > generate an orbit. lon, lat, alt = (0, 0, 20000 * 1000). The point is
> > always in the same point of space.
> > I want that the points remain fixed in the space and they doesn't turn
> > the Earth.
> > In this case a point that has the next values for lon, lat and alt
> > generates an orbit. lon, lat, alt = (0, 0, 20000 * 1000). The point is
> > drawn in differents points of space because the point drawn remain fixed
> > space.
> > For example, we consider that the update interval of Marble clock is
> > s, (10800 s is the time that the Earth use to turn 45º) and that a point
> > with values lon, lat, alt = 0,0, 20000 * 1000 is added in each update of
> > Marble clock. At first, when the time is 0 s, the point p is drawn in
> > 20000 * 1000, then, when the time is 10800 s, the point p is drawn in
> > 20000 * 1000 but the last point p' is in -45, 0, 20000 * 1000 respect the
> > new point p.
> > I have performed this behaviour by recalculating the new lon position in
> > every update but it's very slowly when the number of points is elevated.
> > How can I do this task in a better way? Is it possible to change the
> > reference system using in Marble?
> > Regards.
> > 2012/5/7 marble_developer marble_developer <marbledeveloper at gmail.com>
> > > Hi all,
> > >
> > > Is it possible to change the reference system using in Marble?
> > > In affirmative case, how can I change it?
> > > I need to use an inertial reference system instead of fixed reference
> > > system.
> > >
> > > Best regards.
> Marble-devel mailing list
> Marble-devel at kde.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Marble-devel