Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark sometimes disappear #203

Open
Userpack4 opened this issue Oct 11, 2016 · 4 comments
Open

Mark sometimes disappear #203

Userpack4 opened this issue Oct 11, 2016 · 4 comments

Comments

@Userpack4
Copy link

Userpack4 commented Oct 11, 2016

Hi all,
I have an issue that I'm unable to fix.
I hope someone can give me an hint that can help me.

I created a globe with blueMarble WMSLayer.
Inside a GInitializationTask I created a new Mark with this constructor:
MYMARK = new Mark(label, markBitmapURL, new Geodetic3D(Angle.fromDegrees(12), Angle.fromDegrees(-5), 10), AltitudeMode.ABSOLUTE);

In this case, from the Mark.java source code, the default minDistanceToCamera is 4.5e+06
I set the minDistanceToCamera to MYMARK.setMinDistanceToCamera(4e08).

Then I have a PeriodicalTask that run every seconds a GTask where I set
a new position to MYMARK with a fixed altitude (450km)
MYMARK.setPosition(new Geodetic3D(Angle.fromDegrees(currPos.getLat()), Angle.fromDegrees(currPos.getLon()), 450 * 1000));
Finally to have the camera centered on the mark I set
position = new Geodetic3D(Angle.fromDegrees(currPos.getLat()),
Angle.fromDegrees(currPos.getLon()), 2.5e7);
g3mWidget.setCameraPosition(position);

With logcat I try to visualize the camera height and the state of the Mark (if rendered true or false).
As you can see below the height float from 2.5 and 2.499.. and in some case it is rendered and in some not.
Here is my logcat result.

D/position: 2.5000000000105843E7 -->true
D/position: 2.5000000000099476E7 -->true
D/position: 2.5000000000061966E7 -->true
D/position: 2.5000000000020914E7 -->true
D/position: 2.5000000000002004E7 -->true
D/position: 2.4999999999999076E7 -->true
D/position: 2.4999999999984916E7 -->true
D/position: 2.4999999999947194E7 -->true
D/position: 2.499999999990635E7 -->true
D/position: 2.4999999999894857E7 -->true
D/position: 2.500000000026762E7 -->true
D/position: 2.5E7 -->false
D/position: 2.4999999999999996E7 -->false
D/position: 2.4999999999999996E7 -->false
D/position: 2.4999999999999996E7 -->false
D/position: 2.5E7 -->false
D/position: 2.5000000000000004E7 -->false
D/position: 2.4999999999999996E7 -->false
D/position: 2.5000000000000004E7 -->false
D/position: 2.4999999999724705E7 -->false
D/position: 2.5000000000104334E7 -->false
D/position: 2.5000000000096057E7 -->false
D/position: 2.5000000000056386E7 -->false
D/position: 2.500000000001725E7 -->false
D/position: 2.5000000000001274E7 -->false
D/position: 2.4999999999998484E7 -->false
D/position: 2.4999999999981347E7 -->false
D/position: 2.499999999994127E7 -->false
D/position: 2.499999999990224E7 -->false
D/position: 2.499999999989607E7 -->false
D/position: 2.50000000002806E7 -->false
D/position: 2.5E7 -->true
D/position: 2.5E7 -->true
D/position: 2.5000000000000004E7 -->true
D/position: 2.4999999999999996E7 -->true
D/position: 2.5000000000000004E7 -->true
D/position: 2.5E7 -->true

A simple hint will be appreciated thanks all.

@DiegoGomezDeck
Copy link
Member

Most (if not all) math calculations in G3M use floating point numbers (32 or 64 bits). In this case, it looks like an inevitable consequence of this. (see http://floating-point-gui.de/ )

What I wonder if why you need such a precision?

@Userpack4
Copy link
Author

Thanks for the reply,
No, I don't need this precision.
I need to set the camera height to 25000km and the mark to
450 km, change the mark position and in this scenario I wonder why sometimes it disappear in an unpredictable way.
The only strange things I notice in the Logcat is the small change in camera height like the one reported above.

I haven't yet read your link about the floating point...I read it soon.
Thanks.

@DiegoGomezDeck
Copy link
Member

Not sure of your exactly needs, but take in mind that minDistanceToCamera=0 means "always visible".

@Userpack4
Copy link
Author

Even with minDistanceToCamera=0 the mark is not always visible...sometimes disappear.
If I replace the Mark with a CircleShape all works fine.

My real need is view the mark moving around the globe with the camera centered on it...but sometimes it disappear and I don't know why.
If I can't go around this...I replace it with a CircleShape.

I would like to take this opportunity to thank you for the great works on this framework and for the time devoted to help us on our issue.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants