code: protected void resetOrbitView(OrbitView view)
      {
          if (view.getZoom() > 0)   // already in orbit view mode
              return;
  
          // Find out where on the terrain the eye is looking at in the viewport center
          // TODO: if no terrain is found in the viewport center, iterate toward viewport bottom until it is found
          Vec4 centerPoint = computeSurfacePoint(view, view.getHeading(), view.getPitch());
          // Reset the orbit view center point heading, pitch and zoom
          if (centerPoint != null)
          {
              Vec4 eyePoint = view.getEyePoint();
              // Center pos on terrain surface
              Position centerPosition = wwd.getModel().getGlobe().computePositionFromPoint(centerPoint);
              // Compute pitch and heading relative to center position
              Vec4 normal = wwd.getModel().getGlobe().computeSurfaceNormalAtLocation(centerPosition.getLatitude(),
                  centerPosition.getLongitude());
              Vec4 north = wwd.getModel().getGlobe().computeNorthPointingTangentAtLocation(centerPosition.getLatitude(),
                  centerPosition.getLongitude());
              // Pitch
              view.setPitch(Angle.POS180.subtract(view.getForwardVector().angleBetween3(normal)));
              // Heading
              Vec4 perpendicular = view.getForwardVector().perpendicularTo3(normal);
              Angle heading = perpendicular.angleBetween3(north);
              double direction = Math.signum(-normal.cross3(north).dot3(perpendicular));
              view.setHeading(heading.multiply(direction));
              // Zoom
              view.setZoom(eyePoint.distanceTo3(centerPoint));
              // Center pos
              view.setCenterPosition(centerPosition);
          }
      }
docs: Reset the view to an orbit view state if in first person mode (zoom = 0)
  
  @param view the orbit view to reset