Direct.java 938 Bytes
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/**
 * A test program for the GeographicLib.Geodesic.Direct method
 **********************************************************************/

import java.util.*;
import net.sf.geographiclib.*;
public class Direct {
/**
 * Solve the direct geodesic problem.
 *
 * This program reads in lines with lat1, lon1, azi1, s12 and prints out lines
 * with lat2, lon2, azi2 (for the WGS84 ellipsoid).
 **********************************************************************/
  public static void main(String[] args) {
    try {
      Scanner in = new Scanner(System.in);
      double lat1, lon1, azi1, s12;
      while (true) {
        lat1 = in.nextDouble(); lon1 = in.nextDouble();
        azi1 = in.nextDouble(); s12 = in.nextDouble();
        GeodesicData g = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12);
        System.out.println(g.lat2 + " " + g.lon2 + " " + g.azi2);
      }
    }
    catch (Exception e) {}
  }
}