Method: RubyVolt::Meta::Geography::Point#to_XYZPoint

Defined in:
lib/ruby_volt/meta/geography.rb

#to_XYZPointObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/ruby_volt/meta/geography.rb', line 27

def to_XYZPoint
  radiansPerDegree = (Math::PI/180.0) # A conversion factor.
  latRadians = lat * radiansPerDegree # latitude is in degrees.
  lngRadians = lng * radiansPerDegree # longitude is in degrees.
  cosPhi = Math.cos(latRadians)
  x = Math.cos(lngRadians) * cosPhi
  y = Math.sin(lngRadians) * cosPhi
  z = Math.sin(latRadians)
  [x, y, z]
end