/** OPTION 2 - Compute a new Point from existing Location and Bearing (Heading) */ public static void computePointFromLocBearing(Scanner in) { double[][] pts = getPoints(in, 1); System.out.print(" Enter Bearing : "); double bearing = in.nextDouble(); System.out.print(" Enter Distance: "); double distance = in.nextDouble(); double[] location = GeoProjectionUtils.pointFromLonLatBearing( pts[0][LON_INDEX], pts[0][LAT_INDEX], bearing, distance, null); System.out.println("\n Vincenty: " + location[LON_INDEX] + ", " + location[LAT_INDEX]); System.out.println(" Karney : *** IN WORK ***"); }
public static void reproject(Scanner in, CRS crs) { double[][] point = getPoints(in, crs, 1, 3); System.out.print(" Include ENU (y/n): "); boolean toENU = in.next().equalsIgnoreCase("y"); if (crs == CRS.LLA) { double[] result = GeoProjectionUtils.llaToECF(point[0][LON_INDEX], point[0][LAT_INDEX], 0, null); System.out.println( " Projected to ECEF: " + result[LON_INDEX] + ", " + result[LAT_INDEX] + ", " + result[ALT_INDEX]); if (toENU) { double[][] center = getPoints(in, CRS.LLA, 1, 3); GeoProjectionUtils.llaToENU( point[0][LON_INDEX], point[0][LAT_INDEX], point[0][ALT_INDEX], center[0][LON_INDEX], center[0][LAT_INDEX], center[0][ALT_INDEX], result); System.out.println( " Projected to ENU : " + +result[LON_INDEX] + ", " + result[LAT_INDEX] + ", " + result[ALT_INDEX]); } } else if (crs == CRS.ECEF) { double[] result = GeoProjectionUtils.ecfToLLA( point[0][LON_INDEX], point[0][LAT_INDEX], point[0][ALT_INDEX], null); System.out.println( " Projected to LLA: " + result[LON_INDEX] + ", " + result[LAT_INDEX] + ", " + result[ALT_INDEX]); if (toENU) { double[][] center = getPoints(in, CRS.LLA, 1, 3); GeoProjectionUtils.ecfToENU( point[0][LON_INDEX], point[0][LAT_INDEX], point[0][ALT_INDEX], center[0][LON_INDEX], center[0][LAT_INDEX], center[0][ALT_INDEX], result); System.out.println( " Projected to ENU : " + +result[LON_INDEX] + ", " + result[LAT_INDEX] + ", " + result[ALT_INDEX]); } } else if (crs == CRS.ENU) { double[][] center = getPoints(in, CRS.LLA, 1, 3); double[] result = GeoProjectionUtils.enuToLLA( point[0][LON_INDEX], point[0][LAT_INDEX], point[0][ALT_INDEX], center[0][LON_INDEX], center[0][LAT_INDEX], center[0][ALT_INDEX], null); System.out.println( " Projected to LLA : " + result[LON_INDEX] + ", " + result[LAT_INDEX] + ", " + result[ALT_INDEX]); GeoProjectionUtils.enuToECF( point[0][LON_INDEX], point[0][LAT_INDEX], point[0][ALT_INDEX], center[0][LON_INDEX], center[0][LAT_INDEX], center[0][ALT_INDEX], result); System.out.println( " Projected to ECEF : " + result[LON_INDEX] + ", " + result[LAT_INDEX] + ", " + result[ALT_INDEX]); } }