pixeldistance 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08166d95c44b09cb89185348b620b7c7f33fc92a
4
- data.tar.gz: 8a5f0149c4ff2cd005247d5f11b3f3ad271e85ae
3
+ metadata.gz: 89ecd9ebd31a3a45f3188d7add70346d312de0bf
4
+ data.tar.gz: 184fd84b47547f19e0fc2dbb518bc5f2fa8f84d1
5
5
  SHA512:
6
- metadata.gz: b7b1e0d835c75f04ffc1c3c5afa2433b3df170eb4fd93c9afbc01410bfc856bb4cb88ea6c11e3dfa62ec9997b60af3caa86823580fc4537e7c1bb20014ab48c4
7
- data.tar.gz: b43c4f53459c4662078e109b3c3c12bdc5867ffe67f7db345bffcc466bcc91bc0c7644c13da6c8983628f95a58074cb5f1ae376a930e84fb0466b80f6a3d78d3
6
+ metadata.gz: d64009d2e6caa1089484ce4368bf843d886c298768d8f61b4c0b85c932aea5e597f4892c63cd50ab325a573fa38cadef2189cb38be6598870b7898ad7ff79809
7
+ data.tar.gz: 4542d9b24fccda6bb1ce486645ff946f8962939a86f0d2ee6cf9895be91ecf8493be119a5f676dea11266b3f3e33985ed685f57ce48fe584fe7257d7526f15e6
@@ -5,7 +5,7 @@ module PixelDistance
5
5
  RADIUS = 85445659.4471
6
6
  ZOOM = 12
7
7
 
8
- def self.from_coords(lat1,lon1,lat2,lon2,zoom = nil)
8
+ def from_coords(lat1,lon1,lat2,lon2,zoom = nil)
9
9
  zoom ||= ZOOM
10
10
 
11
11
  x1 = lon_to_x(lon1)
@@ -16,14 +16,15 @@ module PixelDistance
16
16
  Math.sqrt((x1-x2)**2 + (y1-y2)**2).to_i >> (21 - zoom)
17
17
  end
18
18
 
19
- private
20
- def self.lon_to_x(lon)
19
+ def lon_to_x(lon)
21
20
  (OFFSET + RADIUS * lon * Math::PI / 180).to_i
22
21
  end
23
22
 
24
- def self.lat_to_y(lat)
23
+ def lat_to_y(lat)
25
24
  (OFFSET + RADIUS *
26
25
  Math.log((1 + Math.sin(lat * Math::PI / 180)) /
27
26
  (1 - Math.sin(lat * Math::PI / 180))) / 2)
28
27
  end
28
+
29
+ module_function :from_coords,:lon_to_x,:lat_to_y
29
30
  end
@@ -1,3 +1,3 @@
1
1
  module PixelDistance
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixeldistance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Salerno