public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) {
    """
	Transform a "real" longitude and latitude into the rotated longitude (X) and
	rotated latitude (Y).
    """
    double lat = latlon.getLatitude();
    double lon = latlon.getLongitude();

    //	Lon-lat pair to xyz coordinates on sphere with radius 1
    double[] p0 = new double[]
            {Math.cos(lat * RAD_PER_DEG) * Math.cos(lon * RAD_PER_DEG),
                    Math.cos(lat * RAD_PER_DEG) * Math.sin(lon * RAD_PER_DEG),
                    Math.sin(lat * RAD_PER_DEG)};

    //	Rotate around Z-axis
    double[] p1 = new double[]
            {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1] + rotZ[0][2] * p0[2],
                    rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1] + rotZ[1][2] * p0[2],
                    rotZ[2][0] * p0[0] + rotZ[2][1] * p0[1] + rotZ[2][2] * p0[2]};

    //	Rotate around Y-axis
    double[] p2 = new double[]
            {rotY[0][0] * p1[0] + rotY[0][1] * p1[1] + rotY[0][2] * p1[2],
                    rotY[1][0] * p1[0] + rotY[1][1] * p1[1] + rotY[1][2] * p1[2],
                    rotY[2][0] * p1[0] + rotY[2][1] * p1[1] + rotY[2][2] * p1[2]};

    final double lonR = LatLonPointImpl.range180( Math.atan2(p2[1], p2[0]) * DEG_PER_RAD);
    //final double lonR = Math.atan2(p2[1], p2[0]) * DEG_PER_RAD;
    final double latR = Math.asin(p2[2]) * DEG_PER_RAD;

    if (destPoint == null)
      destPoint =  new ProjectionPointImpl(lonR, latR);
    else
      destPoint.setLocation(lonR, latR);

     if (show)
        System.out.println("LatLon= " + latlon+" proj= " + destPoint);

    return destPoint;
  }
public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) {
    double lat = latlon.getLatitude();
    double lon = latlon.getLongitude();

    //	Lon-lat pair to xyz coordinates on sphere with radius 1
    double[] p0 = new double[]
            {Math.cos(lat * RAD_PER_DEG) * Math.cos(lon * RAD_PER_DEG),
                    Math.cos(lat * RAD_PER_DEG) * Math.sin(lon * RAD_PER_DEG),
                    Math.sin(lat * RAD_PER_DEG)};

    //	Rotate around Z-axis
    double[] p1 = new double[]
            {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1] + rotZ[0][2] * p0[2],
                    rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1] + rotZ[1][2] * p0[2],
                    rotZ[2][0] * p0[0] + rotZ[2][1] * p0[1] + rotZ[2][2] * p0[2]};

    //	Rotate around Y-axis
    double[] p2 = new double[]
            {rotY[0][0] * p1[0] + rotY[0][1] * p1[1] + rotY[0][2] * p1[2],
                    rotY[1][0] * p1[0] + rotY[1][1] * p1[1] + rotY[1][2] * p1[2],
                    rotY[2][0] * p1[0] + rotY[2][1] * p1[1] + rotY[2][2] * p1[2]};

    final double lonR = LatLonPointImpl.range180( Math.atan2(p2[1], p2[0]) * DEG_PER_RAD);
    //final double lonR = Math.atan2(p2[1], p2[0]) * DEG_PER_RAD;
    final double latR = Math.asin(p2[2]) * DEG_PER_RAD;

    if (destPoint == null)
      destPoint =  new ProjectionPointImpl(lonR, latR);
    else
      destPoint.setLocation(lonR, latR);

     if (show)
        System.out.println("LatLon= " + latlon+" proj= " + destPoint);

    return destPoint;
  }
public ProjectionPoint latLonToProj ( LatLonPoint latlon , ProjectionPointImpl destPoint ) { double lat = latlon . getLatitude ( ) ; double lon = latlon . getLongitude ( ) ; //	Lon-lat pair to xyz coordinates on sphere with radius 1
 double [ ] p0 = new double [ ] { Math . cos ( lat * RAD_PER_DEG ) * Math . cos ( lon * RAD_PER_DEG ) , Math . cos ( lat * RAD_PER_DEG ) * Math . sin ( lon * RAD_PER_DEG ) , Math . sin ( lat * RAD_PER_DEG ) } ; //	Rotate around Z-axis
 double [ ] p1 = new double [ ] { rotZ [ 0 ] [ 0 ] * p0 [ 0 ] + rotZ [ 0 ] [ 1 ] * p0 [ 1 ] + rotZ [ 0 ] [ 2 ] * p0 [ 2 ] , rotZ [ 1 ] [ 0 ] * p0 [ 0 ] + rotZ [ 1 ] [ 1 ] * p0 [ 1 ] + rotZ [ 1 ] [ 2 ] * p0 [ 2 ] , rotZ [ 2 ] [ 0 ] * p0 [ 0 ] + rotZ [ 2 ] [ 1 ] * p0 [ 1 ] + rotZ [ 2 ] [ 2 ] * p0 [ 2 ] } ; //	Rotate around Y-axis
 double [ ] p2 = new double [ ] { rotY [ 0 ] [ 0 ] * p1 [ 0 ] + rotY [ 0 ] [ 1 ] * p1 [ 1 ] + rotY [ 0 ] [ 2 ] * p1 [ 2 ] , rotY [ 1 ] [ 0 ] * p1 [ 0 ] + rotY [ 1 ] [ 1 ] * p1 [ 1 ] + rotY [ 1 ] [ 2 ] * p1 [ 2 ] , rotY [ 2 ] [ 0 ] * p1 [ 0 ] + rotY [ 2 ] [ 1 ] * p1 [ 1 ] + rotY [ 2 ] [ 2 ] * p1 [ 2 ] } ; final double lonR = LatLonPointImpl . range180 ( Math . atan2 ( p2 [ 1 ] , p2 [ 0 ] ) * DEG_PER_RAD ) ; //final double lonR = Math.atan2(p2[1], p2[0]) * DEG_PER_RAD;
 final double latR = Math . asin ( p2 [ 2 ] ) * DEG_PER_RAD ; if ( destPoint == null ) destPoint = new ProjectionPointImpl ( lonR , latR ) ; else destPoint . setLocation ( lonR , latR ) ; if ( show ) System . out . println ( "LatLon= " + latlon + " proj= " + destPoint ) ; return destPoint ; }
Transform a "real" longitude and latitude into the rotated longitude (X) and
rotated latitude (Y).
Transform a real longitude and latitude into the rotated longitude ( X ) and rotated latitude ( Y ) .