World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 03-27-2009, 02:58 PM   #11
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default

Thank you Pat. I drew and understood it. The earth is not flat so the vertical under the eye and the vertical at the center point are not parallel. And as I see on my drawing it is a little bit hard to find the equation just using the polar coordinates. we have to use the Vec4 class. It may be a future work for me.

For the second case, as you say I cannot use view.computePositionFromScreenPoint. What should I use to take the terrain into account?
lembas is offline   Reply With Quote
Old 03-27-2009, 04:03 PM   #12
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

There are different ways to get a point on the terrain surface. You will find a computeSurfacePoint() method in a couple places in the SDK. The strategy is to try first the terrain geometry and then fall back onto elevation data.

0.6 does include a terrain/line intersection code that should help here. There is also the ray casting support which uses elevation data. Have a look inside the BasicDragger util class used in several examples.

Edit: thinking again about the zoom 'adjustment' formula i proposed in my previous post, i'm wondering whether it is correct... You should figure it out from the drawing though
__________________
My World Wind Java Blog & WW.net Plugins page

Last edited by patmurris; 03-27-2009 at 04:10 PM.
patmurris is offline   Reply With Quote
Old 03-30-2009, 04:36 PM   #13
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default

After many questions here is a little contribution for the community
Code:
	private Position getTerrainPositionFromScreenPoint(WorldWindowGLCanvas wwCanvas, int screenX, int screenY) {
		View view = wwCanvas.getView();
		Line ray = view.computeRayFromScreenPoint(screenX, screenY);
		Intersection[] intersections = wwCanvas.getSceneController().getTerrain().intersect(ray);
		Globe globe = wwCanvas.getModel().getGlobe();
		if (intersections != null && intersections.length > 0)
			return globe.computePositionFromPoint(intersections[0].getIntersectionPoint());
		else
			return RayCastingSupport.intersectRayWithTerrain(globe, ray.getOrigin(), ray.getDirection(), 200, 20);
	}
And about your formula, it does not work
If I click on a lower elevation point on earth, my altitude is decreasing.

Looking at the sketch I drew, I can see that it is not easy to fix the altitude by setting zoom on an ellipsoidal earth.

I could not solve how we can change the eye lat/lon and zoom, keeping the eye altitude and the pitch fixed.
lembas is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:56 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.