public <T extends Point2D>T inverse(double x,double y,T llp){
  if (llp == null) {
    llp=(T)new LatLonPoint.Double();
  }
  x-=wx;
  y=hy - y;
  double rho=Math.sqrt(x * x + y * y);
  if (rho == 0) {
    Debug.message("proj","Orthographic.inverse: center!");
    llp.setLocation(Math.toDegrees(centerX),Math.toDegrees(centerY));
    return llp;
  }
  double sinC=rho / scaled_radius;
  double cosC=Math.sqrt(1 - sinC * sinC);
  double lat=Math.asin(cosC * sinCtrLat + (y * sinC * (cosCtrLat / rho)));
  double lon;
  if (centerY == NORTH_POLE) {
    lon=centerX + Math.atan2(x,-y);
  }
 else   if (centerY == SOUTH_POLE) {
    lon=centerX + Math.atan2(x,y);
  }
 else {
    lon=centerX + Math.atan2((x * sinC),(rho * cosCtrLat * cosC - y * sinCtrLat * sinC));
  }
  if (Double.isNaN(lat) || Double.isNaN(lon)) {
    lat=centerY;
    lon=centerX;
  }
  llp.setLocation(Math.toDegrees(wrapLongitude(lon)),Math.toDegrees(normalizeLatitude(lat)));
  return llp;
}

public < T extends Point2D > T inverse ( double x , double y , T llp ) { if ( llp == null ) { llp = ( T ) new LatLonPoint . Double ( ) ; } x -= wx ; y = hy - y ; double rho = Math . sqrt ( x * x + y * y ) ; if ( rho == 0 ) { Debug . message ( "proj" , "Orthographic.inverse: center!" ) ; llp . setLocation ( Math . toDegrees ( centerX ) , Math . toDegrees ( centerY ) ) ; return llp ; } double sinC = rho / scaled_radius ; double cosC = Math . sqrt ( 1 - sinC * sinC ) ; double lat = Math . asin ( cosC * sinCtrLat + ( y * sinC * ( cosCtrLat / rho ) ) ) ; double lon ; if ( centerY == NORTH_POLE ) { lon = centerX + Math . atan2 ( x , - y ) ; } else if ( centerY == SOUTH_POLE ) { lon = centerX + Math . atan2 ( x , y ) ; } else { lon = centerX + Math . atan2 ( ( x * sinC ) , ( rho * cosCtrLat * cosC - y * sinCtrLat * sinC ) ) ; } if ( Double . isNaN ( lat ) || Double . isNaN ( lon ) ) { lat = centerY ; lon = centerX ; } llp . setLocation ( Math . toDegrees ( wrapLongitude ( lon ) ) , Math . toDegrees ( normalizeLatitude ( lat ) ) ) ; return llp ; }
inverse project x , y coordinates into a latlonpoint .
