title: Calculating distance between two points using pythagorean theorem
body: <p>I'd like to create a function that calculates the distance between two pairs of lat/longs using the pythag theorem instead of the haversine great-circle formula. Since this will be over relative short distances (3km), I think this version that assumes a flat earth should be OK. How can I do this? I asked the internet and didn't come up with anything useful. :)</p>
  
  <p>Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>Here's what I came up with (seems to be working): </p>
  
  <pre><code>def get_dist(lat0, lng0, lat1, lng1)
    begin
      d_ew = (lng1.to_f - lng0.to_f) * Math.cos(lat0.to_f)
      d_ns = (lat1.to_f - lat0.to_f)
      d_lu = Math.sqrt(d_ew.to_f * d_ew.to_f + d_ns.to_f * d_ns.to_f)
      d_mi = ((2*Math::PI*3961.3)/360)*d_lu
      return d_mi
    rescue Exception =&gt; ex
      logger.debug "[get_dist] An exception occurred: #{ex.message}"
      return -1
    end
  end
  </code></pre>