cdm/src/main/java/ucar/unidata/geoloc/projection/VerticalPerspectiveView.java
public ProjectionPoint latLonToProj(LatLonPoint latLon,
                                      ProjectionPointImpl result) {
    double toX, toY;
    double fromLat = latLon.getLatitude();
    double fromLon = latLon.getLongitude();


    fromLat = Math.toRadians(fromLat);
    double lonDiff = Math.toRadians(LatLonPointImpl.lonNormal(fromLon
            - lon0Degrees));
    double cosc = sinLat0 * Math.sin(fromLat)
            + cosLat0 * Math.cos(fromLat) * Math.cos(lonDiff);
    double ksp = (P - 1.0) / (P - cosc);
    if (cosc < 1.0 / P) {
      toX = Double.POSITIVE_INFINITY;
      toY = Double.POSITIVE_INFINITY;
    } else {
      toX = false_east
              + R * ksp * Math.cos(fromLat) * Math.sin(lonDiff);
      toY = false_north
              + R * ksp
              * (cosLat0 * Math.sin(fromLat)
              - sinLat0 * Math.cos(fromLat) * Math.cos(lonDiff));
    }

    result.setLocation(toX, toY);
    return result;
  }
public ProjectionPoint latLonToProj(LatLonPoint latLon,
                                      ProjectionPointImpl result) {
    double toX, toY;
    double fromLat = latLon.getLatitude();
    double fromLon = latLon.getLongitude();


    fromLat = Math.toRadians(fromLat);
    double lonDiff = Math.toRadians(LatLonPointImpl.lonNormal(fromLon
            - lon0Degrees));
    double cosc = sinLat0 * Math.sin(fromLat)
            + cosLat0 * Math.cos(fromLat) * Math.cos(lonDiff);
    double ksp = (P - 1.0) / (P - cosc);
    if (cosc < 1.0 / P) {
      toX = Double.POSITIVE_INFINITY;
      toY = Double.POSITIVE_INFINITY;
    } else {
      toX = false_east
              + R * ksp * Math.cos(fromLat) * Math.sin(lonDiff);
      toY = false_north
              + R * ksp
              * (cosLat0 * Math.sin(fromLat)
              - sinLat0 * Math.cos(fromLat) * Math.cos(lonDiff));
    }

    result.setLocation(toX, toY);
    return result;
  }
public ProjectionPoint latLonToProj ( LatLonPoint latLon , ProjectionPointImpl result ) { double toX , toY ; double fromLat = latLon . getLatitude ( ) ; double fromLon = latLon . getLongitude ( ) ; fromLat = Math . toRadians ( fromLat ) ; double lonDiff = Math . toRadians ( LatLonPointImpl . lonNormal ( fromLon - lon0Degrees ) ) ; double cosc = sinLat0 * Math . sin ( fromLat ) + cosLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ; double ksp = ( P - 1.0 ) / ( P - cosc ) ; if ( cosc < 1.0 / P ) { toX = Double . POSITIVE_INFINITY ; toY = Double . POSITIVE_INFINITY ; } else { toX = false_east + R * ksp * Math . cos ( fromLat ) * Math . sin ( lonDiff ) ; toY = false_north + R * ksp * ( cosLat0 * Math . sin ( fromLat ) - sinLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ) ; } result . setLocation ( toX , toY ) ; return result ; }
Convert a LatLonPoint to projection coordinates

@param latLon convert from these lat, lon coordinates
@param result the object to write to
@return the given result
Convert a LatLonPoint to projection coordinates