![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Member
Join Date: Oct 2007
Posts: 40
![]() |
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? |
|
|
|
|
|
#12 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
![]() |
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 ![]() Last edited by patmurris; 03-27-2009 at 04:10 PM. |
|
|
|
|
|
#13 |
|
Member
Join Date: Oct 2007
Posts: 40
![]() |
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);
}
![]() 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. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|