Skip to content

Commit 47e5c8e

Browse files
authored
Vectorixe loxodrome_inverse() (#1881)
1 parent 568e32d commit 47e5c8e

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/loxodromics.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ function loxodrome_inverse(lon1, lat1, lon2, lat2, a=6378137.0, f=0.003352810664
3232
isolat2 = isometric_lat(lat2, e2)
3333

3434
# Compute changes in isometric latitude and longitude between P1 and P2
35-
Az12 = atan((lon2 - lon1), (isolat2 - isolat1)) # The azimuth
35+
Az12 = atan.((lon2 .- lon1), (isolat2 .- isolat1)) # The azimuth
3636
# Compute distance along loxodromic curve
3737
m1 = meridian_dist(lat1, a, e2)
3838
m2 = meridian_dist(lat2, a, e2)
39-
lox_s = (m2 - m1) / cos(Az12);
39+
lox_s = (m2 .- m1) ./ cos.(Az12);
4040
return lox_s, Az12 / D2R
4141
end
4242

@@ -99,11 +99,11 @@ function loxodrome_direct(lon, lat, azim, dist, a=6378137.0, f=0.003352810664747
9999
end
100100

101101
function f_phi(lat, A0, A2, A4, A6, A8, A10)
102-
A0*lat - (A2/2)*sin(2*lat) + (A4/4)*sin(4*lat) - (A6/6)*sin(6*lat) + (A8/8)*sin(8*lat) - (A10/10)*sin(10*lat)
102+
A0*lat .- (A2/2)*sin.(2*lat) .+ (A4/4)*sin.(4*lat) .- (A6/6)*sin.(6*lat) .+ (A8/8)*sin.(8*lat) .- (A10/10)*sin.(10*lat)
103103
end
104104

105105
function f_prime_phi(lat, A0, A2, A4, A6, A8, A10)
106-
A0 - A2 * cos(2*lat) + A4 * cos(4*lat) - A6 * cos(6*lat) + A8 * cos(8*lat) - A10 * cos(10*lat)
106+
A0 .- A2 * cos.(2*lat) .+ A4 * cos.(4*lat) .- A6 * cos.(6*lat) .+ A8 * cos.(8*lat) .- A10 * cos.(10*lat)
107107
end
108108

109109
function meridian_dist(lat, a, e2)
@@ -129,8 +129,8 @@ end
129129
function isometric_lat(lat, ecc2)
130130
# Compute isometric latitude. ECC2 is the squared eccentricity = f*(2-f), where f is the flattening
131131
ecc = sqrt(ecc2)
132-
x = ecc * sin(lat)
133-
y = (1-x) / (1+x)
134-
z = pi/4 + lat/2
135-
log(tan(z) * (y^(ecc/2)))
132+
x = ecc .* sin.(lat)
133+
y = (1 .- x) ./ (1 .+ x)
134+
z = pi/4 .+ lat/2
135+
log.(tan.(z) .* (y.^(ecc/2)))
136136
end

0 commit comments

Comments
 (0)