| | |
| | | return new Coordinate(newX, newY, newZ); |
| | | } |
| | | |
| | | public static void toTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | public static Coordinate toTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | { |
| | | double x0, y0, x1, y1, m0, m1; |
| | | double n, t, c, A; |
| | |
| | | + n * Math.tan(y0) |
| | | * (A * A / 2.0 + (5.0 - t + 9.0 * c + 4 * c * c) * Math.pow(A, 4.0) / 24.0 |
| | | + (61.0 - 58.0 * t + t * t + 600.0 * c - 330.0 * ecc2) * Math.pow(A, 6.0) / 720.0)); |
| | | return new Coordinate(newX, newY); |
| | | } |
| | | |
| | | public static void fromTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | public static Coordinate fromTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | { |
| | | double newX, newY; |
| | | double x0, y0, x1, y1, phi, m, m0, mu, e1; |
| | |
| | | * (d * d / 2.0 - (5.0 + 3.0 * t1 + 10.0 * c1 - 4.0 * c1 * c1 - 9.0 * ecc2) * Math.pow(d, 4.0) / 24.0 |
| | | + (61.0 + 90.0 * t1 + 298.0 * c1 + 45.0 * t1 * t1 - 252.0 * ecc2 - 3.0 * c1 * c1) * Math.pow(d, 6.0) |
| | | / 72.0)) * RAD_DEG; |
| | | return new Coordinate(newX, newY); |
| | | } |
| | | |
| | | private static double mercator(double y, double a, double ecc) |
| | |
| | | * printf("Acuuracy (%.4f, X:%.4f, Y:%.4f)nn", sqrt((dx1-tx1)*(dx1-tx1)+(dy1-ty1)*(dy1-ty1)), (dx1-tx1), (dy1-ty1)); |
| | | * } |
| | | */ |
| | | |
| | | public static Coordinate fromTM2ToTWD97(Coordinate pt) |
| | | { |
| | | return fromTM2(TWD97_A,TWD97_ECC,TWD97_ECC2, 0, 121, TWD97_TM2, pt.x, pt.y); |
| | | } |
| | | } |