Module: GeoMagic::Calculate::ClassMethods

Included in:
GeoMagic::Calculate
Defined in:
lib/geo_magic/calculate.rb

Instance Method Summary collapse

Instance Method Details

#distance(from_point, to_point, options = { :unit => :meters }) ⇒ Object



13
14
15
16
17
# File 'lib/geo_magic/calculate.rb', line 13

def distance from_point, to_point, options = { :unit => :meters }
  points = extract_points from_point, to_point
  dist = ::GeoDistance.distance( *points )[options[:unit]]
  dist.number
end

#plane_distance(from_point, to_point, options = { :unit => :meters }) ⇒ Object



19
20
21
22
# File 'lib/geo_magic/calculate.rb', line 19

def plane_distance from_point, to_point, options = { :unit => :meters }
  points = extract_points from_point, to_point
  Math.sqrt((points[0] - points[2] + points[1] - points[3]).abs)
end