protected Vec4 computeSurfacePoint ( OrbitView view , Angle heading , Angle pitch ) { Globe globe = wwd . getModel ( ) . getGlobe ( ) ; // Compute transform to be applied to north pointing Y so that it would point in the view direction // Move coordinate system to view center point Matrix transform = globe . computeSurfaceOrientationAtPosition ( view . getCenterPosition ( ) ) ; // Rotate so that the north pointing axes Y will point in the look at direction transform = transform . multiply ( Matrix . fromRotationZ ( heading . multiply ( - 1 ) ) ) ; transform = transform . multiply ( Matrix . fromRotationX ( Angle . NEG90 . add ( pitch ) ) ) ; // Compute forward vector Vec4 forward = Vec4 . UNIT_Y . transformBy4 ( transform ) ; // Return intersection with terrain Intersection [ ] intersections = wwd . getSceneController ( ) . getTerrain ( ) . intersect ( new Line ( view . getEyePoint ( ) , forward ) ) ; return ( intersections != null && intersections . length != 0 ) ? intersections [ 0 ] . getIntersectionPoint ( ) : null ; }
Find out where on the terrain surface the eye would be looking at with the given heading and pitch angles .