# File lib/jpmobile/datum_conv.rb, line 31 def self.xyz2blh(x,y,z,datum) a = datum[0].to_f f = 1.0/datum[1] e2 = f * (2 - f) l = Math.atan2(y,x) p = Math.sqrt(x**2+y**2) r = Math.sqrt(p**2+z**2) u = Math.atan2(z*((1-f)+e2*a/r),p) b = Math.atan2(z*(1-f)+e2*a*Math.sin(u)**3,(1-f)*(p-e2*a*Math.cos(u)**3)) he = p*Math.cos(b) + z*Math.sin(b) - a*Math.sqrt(1-e2*Math.sin(b)**2) b_deg = b / Deg2Rad l_deg = l / Deg2Rad return b_deg,l_deg,he end