rgeo 1.1.1 → 1.1.2

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
  SHA256:
3
- metadata.gz: f60f96ff950b9d39762392b471cd0be70fce1510daa17958da531f76d14c7f34
4
- data.tar.gz: b30460450e679b6a46599a68171b6b8de69134913dfbc7d6c6f5a47c209207d0
3
+ metadata.gz: d0760bb96d9e6654cf7cb09bd88b4a799f5ba249f573fd4c0484df2269ba50a0
4
+ data.tar.gz: 73928442258c96603367a340aac3cd1f93bed12471854e17cf14a712d58bb711
5
5
  SHA512:
6
- metadata.gz: 638a465a19dbf4352b1ad4977a7193b228f62824ffaf93686f045383e8315bee5334ab978b5690f4d035fb1f091e6c905f9fbe941d50c2570c97c70215f94666
7
- data.tar.gz: 5cbcb7893970f4b6819ca66112e09a3f3222bb7fdc529b6cf8af134cac4ee1018b66995b41a2227df45b2be7339c713ba7b59835eef833f686269eb97a1717b6
6
+ metadata.gz: 961f639e7a8985cbcdff0b166cdf2923a6a8a4c4143e55b66a2769d5897abdacb42a6abceaa2b92c870f648e867154df996e55d5ab9a50bbbe70a6c4eef5c7bd
7
+ data.tar.gz: ff8f393c6c5ef195c790836a4ba844867d54c7cf4e8a7266d86c4bd0f44025a58a90debad8a77521288ef1ffe8db0906575e52de9a5dc49d5507fb03aee43765
@@ -50,26 +50,29 @@ module RGeo
50
50
 
51
51
  # Now add the angles and count revolutions.
52
52
  # Again, our running sum is represented as a cos/sin pair.
53
- revolutions_ = 0
54
- sin_ = 0.0
55
- cos_ = 1.0
56
- angs_.each_slice(2) do |(x_, y_)|
57
- ready_ = y_ > 0.0 && sin_ > 0.0 || y_ < 0.0 && sin_ < 0.0
58
- if y_ != 0.0
59
- s_ = sin_ * x_ + cos_ * y_
60
- c_ = cos_ * x_ - sin_ * y_
61
- r_ = ::Math.sqrt(s_ * s_ + c_ * c_)
62
- sin_ = s_ / r_
63
- cos_ = c_ / r_
53
+ revolutions = 0
54
+ direction = nil
55
+ sin = 0.0
56
+ cos = 1.0
57
+ angs_.each_slice(2) do |(x, y)|
58
+ ready = y > 0.0 && (sin > 0.0 || sin == 0.0 && direction == -1) || y < 0.0 && (sin < 0.0 || sin == 0.0 && direction == 1)
59
+ if y != 0.0
60
+ s = sin * x + cos * y
61
+ c = cos * x - sin * y
62
+ r = ::Math.sqrt(s * s + c * c)
63
+ sin = s / r
64
+ cos = c / r
64
65
  end
65
- next unless ready_
66
- if y_ > 0.0 && sin_ <= 0.0
67
- revolutions_ += 1
68
- elsif y_ < 0.0 && sin_ >= 0.0
69
- revolutions_ -= 1
66
+ next unless ready
67
+ if y > 0.0 && sin <= 0.0
68
+ revolutions += 1
69
+ direction = 1
70
+ elsif y < 0.0 && sin >= 0.0
71
+ revolutions -= 1
72
+ direction = -1
70
73
  end
71
74
  end
72
- revolutions_
75
+ revolutions
73
76
  end
74
77
  end
75
78
  end
@@ -1,3 +1,3 @@
1
1
  module RGeo
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "1.1.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma, Tee Parham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-06 00:00:00.000000000 Z
11
+ date: 2018-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake