projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1b6f3de
)
altoslib: Convert longitude from distance in AltosMapTransform
author
Keith Packard
<keithp@keithp.com>
Sun, 12 Jul 2015 02:13:37 +0000
(19:13 -0700)
committer
Keith Packard
<keithp@keithp.com>
Sun, 12 Jul 2015 02:13:37 +0000
(19:13 -0700)
This computes the longitude cooresponding to a specific distance at a
specific latitude.
Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosMapTransform.java
patch
|
blob
|
history
diff --git
a/altoslib/AltosMapTransform.java
b/altoslib/AltosMapTransform.java
index 11ed4eb9c238e887669fe38ad9d64d1814ea2091..7615c83b3f530b79f3189c8ac34552e584aa8e38 100644
(file)
--- a/
altoslib/AltosMapTransform.java
+++ b/
altoslib/AltosMapTransform.java
@@
-117,4
+117,12
@@
public class AltosMapTransform {
offset_x = centre_pt.x - width / 2.0;
offset_y = centre_pt.y - height / 2.0;
}
+
+ public static double lon_from_distance(double lat, double distance) {
+ double c = AltosGreatCircle.earth_radius * Math.cos(lat * Math.PI / 180) * 2 * Math.PI;
+
+ if (c < 10)
+ return 0;
+ return distance/c * 360.0;
+ }
}