I guess because this is base 60 that trying three 60 on the left is worth a
try
60 60 60#:3849
1 4 9
60 60 60 #:_1317
59 38 3
60 60 60 #:1317
0 21 57
Still it is 21 57 and not _21 _57 as I started out with
2009/3/30 Björn Helgason <[email protected]>
> One of the things I am trying to figure out is this conversion backI have
>
> LAT1=: 1r10800p1 * 60 #. 64 9 NB. Reykjavík
> LON1=: 1r10800p1 * 60 #. _21 _57 NB. Reykjavík
>
> Ok I take this here
> 60 #. _21 _57
> 60 #. 64 9
> 3849
> 60 #. _21 _57
> _1317
>
> Now I want thew original back
> 180 60#:3849
> 64 9
>
> Fine and now the other one
> 90 60 #: _1317
> 68 3
>
> Not so fine I guess I have to subtract 90 and 60
> 68 3-90 60
> _22 _57
>
> Close - should be _21 _57
> Should I have subtracted 89 60?
>
> 68 3-89 60
> _21 _57
>
>
> 2009/3/29 Dan Baronet <[email protected]>
>
> Several years ago I wrote a navigation planner in J which included several
>> formulas for distance, heading determination, fuel consumption, etc. and I
>> used for years to travel.
>> Let me know if it can be of any use.
>> /D
>>
>> --- On Sun, 3/29/09, Björn Helgason <[email protected]> wrote:
>>
>> From: Björn Helgason <[email protected]>
>> Subject: Re: [Jprogramming] Finding GPS coordinates with J
>> To: "Programming forum" <[email protected]>
>> Date: Sunday, March 29, 2009, 9:36 AM
>>
>> I think I got the formula here so it is a question of translating it to J
>> and then to get the ring is to do the calculation for i.360 degrees and x
>> distance
>>
>> ---------------------------------
>> Formula: α = d/R (angular distance)
>> lat2 = lat1 + α.cos(θ)
>> Δφ = ln(tan(lat2/2+π/4)/tan(lat1/2+π/4))
>> if E:W line q = cos(lat1)
>> otherwise q = Δlat/Δφ
>> Δlon = α.sin(θ)/q
>> lon2 = (lon1+Δlon+π) % 2.π − π
>> where ln is natural log and % is modulo, Δlon is taking shortest route
>> (<180°), and R is the earth’s radius
>> JavaScript:
>> lat2 = lat1 + d*Math.cos(brng);
>> var dPhi =
>> Math.log(Math.tan(lat2/2+Math.PI/4)/Math.tan(lat1/2+Math.PI/4));
>> var q = (Math.abs(lat2-lat1) > 1e-10) ? (lat2-lat1)/dPhi : Math.cos(lat1);
>> var dLon = d*Math.sin(brng)/q;
>> // check for some daft bugger going past the pole, normalise latitude if
>> so
>> if (Math.abs(lat2) > Math.PI/2) lat2 = lat2>0 ? Math.PI-lat2 :
>> -(Math.PI-lat2);
>> lon2 = (lon1+dLon+Math.PI)%(2*Math.PI) - Math.PI;
>>
>> --------------------
>> Formula: lat2 = asin(sin(lat1)*cos(d/R) + cos(lat1)*sin(d/R)*cos(θ))
>> lon2 = lon1 + atan2(sin(θ)*sin(d/R)*cos(lat1),
>> cos(d/R)−sin(lat1)*sin(lat2))
>> d/R is the angular distance (in radians), where d is the distance
>> travelled and R is the earth’s radius
>> JavaScript:
>> var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) +
>> Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
>> var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1),
>> Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
>> Excel: lat2: =ASIN(SIN(lat1)*COS(d/ER) + COS(lat1)*SIN(d/ER)*COS(brng))
>> lon2: =lon1 + ATAN2(COS(d/ER)-SIN(lat1)*SIN(lat2),
>> SIN(brng)*SIN(d/ER)*COS(lat1))
>> ---------------------------
>> Trig functions take arguments in radians, so latitude, longitude, and
>> bearings in degrees
>> (either decimal or degrees/minutes/seconds) need to be converted to
>> radians, rad = π.deg/180.
>> When converting radians back to degrees (deg = 180.rad/π), West is
>> negative
>> if using signed
>> decimal degrees. For bearings, values in the range -π to +π [-180° to
>> +180°]
>> need to be converted
>> to 0 to +2π [0°–360°]; this can be done by (brng+2.π)%2.π [brng+360)%360]
>> where % is the modulo
>> operator.
>>
>> 2009/3/29 Björn Helgason <[email protected]>
>>
>> > Thx
>> > I took a quick look at the links and it looks like there are good
>> formulas
>> > available.
>> > I hope to get some time soon to translate them into J as I want.
>> >
>> > 2009/3/28 Brian Schott <[email protected]>
>> >
>> > Bjorn,
>> >>
>> >> This search provides some good leads, I believe.
>> >>
>> >>
>> >>
>> http://www.google.com/search?hl=en&client=safari&rls=en&q=distance%2Cbearing+sphere&btnG=Search
>> >>
>> >>
>> >>
>> >> --
>> >> (B=) <-----my sig
>> >> Brian Schott
>> >> ----------------------------------------------------------------------
>> >> For information about J forums see http://www.jsoftware.com/forums.htm
>> >>
>> >
>> >
>> >
>> > --
>> > Björn Helgason, Verkfræðingur
>> > Fugl&Fiskur ehf,
>> > Þerneyjarsundi 23, Hraunborgum
>> > Po Box 127,801 Selfoss ,
>> > t-póst: [email protected]
>> > gsm: +3546985532
>> > Landslags og skrúðgarðagerð, gröfuþjónusta
>> > http://groups.google.com/group/J-Programming
>> >
>> >
>> > Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari
>> einfaldleikans
>> >
>> > góður kennari getur stigið á tær án þess að glansinn fari af skónum
>> > /|_ .-----------------------------------.
>> > ,' .\ / | Með léttri lund verður |
>> > ,--' _,' | Dagurinn í dag |
>> > / / | Enn betri en gærdagurinn |
>> > ( -. | `-----------------------------------'
>> > | ) | (\_ _/)
>> > (`-. '--.) (='.'=) ♖♘♗♕♔♙
>> > `. )----' (")_(") ☃☠
>> >
>>
>>
>>
>> --
>> Björn Helgason, Verkfræðingur
>> Fugl&Fiskur ehf,
>> Þerneyjarsundi 23, Hraunborgum
>> Po Box 127,801 Selfoss ,
>> t-póst: [email protected]
>> gsm: +3546985532
>> Landslags og skrúðgarðagerð, gröfuþjónusta
>> http://groups.google.com/group/J-Programming
>>
>>
>> Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
>>
>> góður kennari getur stigið á tær án þess að glansinn fari af skónum
>> /|_ .-----------------------------------.
>> ,' .\ / | Með léttri lund verður |
>> ,--' _,' | Dagurinn í dag |
>> / / | Enn betri en gærdagurinn |
>> ( -. | `-----------------------------------'
>> | ) | (\_ _/)
>> (`-. '--.) (='.'=) ♖♘♗♕♔♙
>> `. )----' (")_(") ☃☠
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> Björn Helgason, Verkfræðingur
> Fugl&Fiskur ehf,
> Þerneyjarsundi 23, Hraunborgum
> Po Box 127,801 Selfoss ,
> t-póst: [email protected]
> gsm: +3546985532
> Landslags og skrúðgarðagerð, gröfuþjónusta
> http://groups.google.com/group/J-Programming
>
>
> Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
>
> góður kennari getur stigið á tær án þess að glansinn fari af skónum
> /|_ .-----------------------------------.
> ,' .\ / | Með léttri lund verður |
> ,--' _,' | Dagurinn í dag |
> / / | Enn betri en gærdagurinn |
> ( -. | `-----------------------------------'
> | ) | (\_ _/)
> (`-. '--.) (='.'=) ♖♘♗♕♔♙
> `. )----' (")_(") ☃☠
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Þerneyjarsundi 23, Hraunborgum
Po Box 127,801 Selfoss ,
t-póst: [email protected]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm