Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
produce 6 sigfig, not 7
+intermediate variables
Line 528:
local function find_M ( lat_rad )
local e = OSGBglobe.ecc
local e2 = e*e
local e3 = e*e*e
 
return OSGBglobe.semimajor * ( ( 1 - e/4 - 3 * e * ee2/64
- 5 * e * e * ee3/256
) * lat_rad
- ( 3 * e/8 + 3 * e * ee2/32
+ 45 * e * e * ee3/1024
) * sin(2 * lat_rad)
+ ( 15 * e * ee2/256 +
45 * e * e * ee3/1024
) * sin(4 * lat_rad)
- ( 35 * e * e * ee3/3072
) * sin(6 * lat_rad) )
end
Line 561 ⟶ 563:
 
local v = OSGBglobe.semimajor / sqrt(1 - e * sin(lat_rad)*sin(lat_rad))
local Ttank = pow( tan(lat_rad), 2)
local T = tank*tank
local T2 = T*T
local C = e_prime_sq * pow( cos(lat_rad), 2)
local A = deg2rad( longitude2 -OSGBglobe.lon0 ) * cos(lat_rad)
local A2 = A*A
local A3 = A2*A
local A4 = A2*A2
local A5 = A3*A2
local A6 = A3*A3
local M = find_M( lat_rad )
local M0 = 0.0
Line 572 ⟶ 581:
local northing = OSGBglobe.n0 + OSGBglobe.scale *
( (M - M0) + v*tan(lat_rad) *
( A*AA2/2
+ (5 - T + 9*C + 4*C*C) * pow(A,4)A4/24
+ (61 - 58*T + T*T T2
+ 600*C - 330*e_prime_sq) * pow(A,6)A6/720 ))
 
local easting = OSGBglobe.e0 + OSGBglobe.scale * v *
( A
+ (1-T+C)*pow(A,3)A3/6
+ (5 - 18*T + pow(T,2)T2 + 72*C
- 58 * e_prime_sq)*pow(A,5)A5/120 )
 
return {northing=northing,easting=easting}