summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-08-26 23:43:00 -0700
committerKeith Packard <keithp@keithp.com>2010-08-26 23:43:00 -0700
commit3dc67c1401976d6e9e2e942d5a4707a4810a0404 (patch)
tree3778eb9a0329a1bd1b9191622759e2e0ac1da379
parentf0fd423d0bf83bc5c3f9d39e9c09397fbe8caed2 (diff)
altosui: Add AltosGreatCircle constructors
This adds constructurs from AltosGPS pairs and also one from empty args (which defines both distance and bearing as 0). Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/AltosGreatCircle.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/ao-tools/altosui/AltosGreatCircle.java b/ao-tools/altosui/AltosGreatCircle.java
index 878da03e..07c02c16 100644
--- a/ao-tools/altosui/AltosGreatCircle.java
+++ b/ao-tools/altosui/AltosGreatCircle.java
@@ -17,6 +17,8 @@
package altosui;
+import altosui.AltosGPS;
+
import java.lang.Math;
public class AltosGreatCircle {
@@ -28,8 +30,8 @@ public class AltosGreatCircle {
static final double rad = Math.PI / 180;
static final double earth_radius = 6371.2 * 1000; /* in meters */
- AltosGreatCircle (double start_lat, double start_lon,
- double end_lat, double end_lon)
+ public AltosGreatCircle (double start_lat, double start_lon,
+ double end_lat, double end_lon)
{
double lat1 = rad * start_lat;
double lon1 = rad * -start_lon;
@@ -63,4 +65,13 @@ public class AltosGreatCircle {
distance = d * earth_radius;
bearing = course * 180/Math.PI;
}
+
+ public AltosGreatCircle(AltosGPS start, AltosGPS end) {
+ this(start.lat, start.lon, end.lat, end.lon);
+ }
+
+ public AltosGreatCircle() {
+ distance = 0;
+ bearing = 0;
+ }
}