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

    fromLat = Math.toRadians(fromLat);

    dy = radius * (fromLat - lat0);
    dx = radius * Math.cos(fromLat)
            * (Math.toRadians(fromLon) - lon0);


    toX = cosRot * dx - sinRot * dy;
    toY = sinRot * dx + cosRot * dy;


    result.setLocation(toX, toY);

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

    fromLat = Math.toRadians(fromLat);

    dy = radius * (fromLat - lat0);
    dx = radius * Math.cos(fromLat)
            * (Math.toRadians(fromLon) - lon0);


    toX = cosRot * dx - sinRot * dy;
    toY = sinRot * dx + cosRot * dy;


    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