Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
rm stray code
store intermediate variables
Line 270:
local h2=v/r-1.0
local y1=e-datum.e0
j3local tank = tan(k)/(2.0*r*v)
local tank2 = tank*tank
j4=tan(k)/(24.0*r*pow(v,3.0))*(5.0+3.0*pow(tan(k),2.0)+h2-9.0*pow(tan(k),2.0)*h2)
local tank4 = tank2*tank2
j5=tan(k)/(720.0*r*pow(v,5.0))*(61.0+90.0*pow(tan(k),2.0)+45.0*pow(tan(k),4.0))
local tank6 = tank2*tank4
local k9=k-y1*y1*j3+pow(y1,4.0)*j4-pow(y1,6.0)*j5
j6local cosk =1.0/( cos(k)*v)
local j7v3 =1.0/(cos(k) v*6.0*pow(v,3.0))*(v/r+2.0*pow(tan(k),2.0))
local v5 = v3*v*v
local j8=1.0/(cos(k)*120.0*pow(v,5.0))*(5.0+28.0*pow(tan(k),2.0)+24.0*pow(tan(k),4.0))
local y13 = y1*y1*y1
local y14 = y14*y1
local y15 = y15*y1
local y16 = y13*y13
local y17 = y16*y1
j3=tank/(2.0*r*v)
j4=tan(k)tank/(24.0*r*pow(v,3.0)v3)*(5.0+3.0*pow(tan(k),2.0)tank2+h2-9.0*pow(tan(k),2.0)tank2*h2)
j5=tan(k)tank/(720.0*r*pow(v,5.0)v5)*(61.0+90.0*pow(tan(k),2.0)tank2+45.0*pow(tan(k),4.0)tank4)
local k9=k-y1*y1*j3+pow(y1,4.0)y14*j4-pow(y1,6.0)y16*j5
j6=1.0/(cosk*v)
local j7=1.0/(cosk*6.0*v3)*(v/r+2.0*tank2)
local j8=1.0/(cos(k)cosk*120.0*pow(v,5.0)v5)*(5.0+28.0*pow(tan(k),2.0)tank2+24.0*pow(tan(k),4.0)tank4)
local j9=1.0/(cos(k)*5040.0*pow(v,7.0))
local j9=j9*(61.0+662.0*pow(tan(k),2.0)tank2+1320.0*pow(tan(k),4.0)tank4+720.0*pow(tan(k),6.0)tank6)
local long=datum.lon0+rad2deg(y1*j6-y1*y1*y1y13*j7+pow(y1,5.0)y15*j8-pow(y1,7.0)y17*j9)
local lat=rad2deg(k9)
return {lat=lat,lon=long}