vincenty 1.0.9 → 1.0.10
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 +4 -4
- data/History.txt +6 -0
- data/lib/angle.rb +10 -10
- data/lib/core_extensions.rb +0 -21
- data/lib/vincenty.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37c0c0922bddbfdd5dcef8f791bfabdaa154392b34b87ae9a12211c2e3d97de6
|
4
|
+
data.tar.gz: 3cf931671b138ab6552b90aafc9d483fce1fbe8329a46f4573526a1bd6c1d750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 416ffed90caaa6f501b3114585934fa406e212782075b3cabd38acebf9b7d15414dd05d17ce1d2032469c497ca8107d1c3238022a714f016801595ced91b9307
|
7
|
+
data.tar.gz: d5f2ca7b476ffafc99da3a517e849ce3d6ccb05448c7565f586d6d2e92684c8c8ac7ed91241ce06b293abeb1566777af4f95c9c62be1abb0721a10102a096a4e
|
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
robertburrowes Sun Oct 10 12:07:45 2021 +1300
|
2
|
+
Inc version
|
3
|
+
robertburrowes Sun Oct 10 12:05:54 2021 +1300
|
4
|
+
removed Float.round, as ruby now does this. removed to_r, as it is now defined in the core ruby libraries, with a different meaning
|
5
|
+
robertburrowes Sun Oct 10 11:44:09 2021 +1300
|
6
|
+
Chmod, adding world readable
|
1
7
|
robertburrowes Sun Oct 10 11:39:21 2021 +1300
|
2
8
|
Bump Version, after removing stray '.'
|
3
9
|
robertburrowes Fri Oct 8 16:32:19 2021 +1300
|
data/lib/angle.rb
CHANGED
@@ -141,26 +141,26 @@ class Angle
|
|
141
141
|
# @return [Angle,self]
|
142
142
|
# @param [Angle,Numeric] angle
|
143
143
|
def **(other)
|
144
|
-
self.class.radians(@angle**other)
|
144
|
+
return self.class.radians(@angle**other)
|
145
145
|
end
|
146
146
|
|
147
147
|
# Binary division operator. Can add angles and numbers, or two angles.
|
148
148
|
# @return [Angle,self]
|
149
149
|
# @param [Angle,Numeric] angle
|
150
150
|
def /(other)
|
151
|
-
self.class.radians(@angle / other)
|
151
|
+
return self.class.radians(@angle / other)
|
152
152
|
end
|
153
153
|
|
154
154
|
# Binary mod operator. Can add angles and numbers, or two angles.
|
155
155
|
# @return [Angle,self]
|
156
156
|
# @param [Angle,Numeric] angle
|
157
157
|
def %(other)
|
158
|
-
self.class.radians(@angle % other)
|
158
|
+
return self.class.radians(@angle % other)
|
159
159
|
end
|
160
160
|
|
161
161
|
# @return [Float] angle in degrees
|
162
162
|
def to_degrees
|
163
|
-
@angle.to_degrees
|
163
|
+
return @angle.to_degrees
|
164
164
|
end
|
165
165
|
|
166
166
|
# @return [Float] angle in degrees
|
@@ -169,7 +169,7 @@ class Angle
|
|
169
169
|
|
170
170
|
# @return [Float] angle in radians
|
171
171
|
def to_radians
|
172
|
-
@angle
|
172
|
+
return @angle
|
173
173
|
end
|
174
174
|
|
175
175
|
alias to_rad to_radians
|
@@ -205,7 +205,7 @@ class Angle
|
|
205
205
|
|
206
206
|
# @return [Fixnum] the angle truncated to an integer, in radians.
|
207
207
|
def to_i
|
208
|
-
to_radians.to_i
|
208
|
+
return to_radians.to_i
|
209
209
|
end
|
210
210
|
|
211
211
|
# @return [Fixnum] the angle truncated to an integer, in radians.
|
@@ -214,23 +214,23 @@ class Angle
|
|
214
214
|
# @return [Array] the angle parameter as a Float and the @angle parameter from this class.
|
215
215
|
# @param [Numeric] angle
|
216
216
|
def coerce(angle)
|
217
|
-
[ Float(angle), @angle ]
|
217
|
+
return [ Float(angle), @angle ]
|
218
218
|
end
|
219
219
|
|
220
220
|
# @return [Fixnum] the sign of the angle. 1 for positive, -1 for negative.
|
221
221
|
def sign
|
222
|
-
@angle.sign
|
222
|
+
return @angle.sign
|
223
223
|
end
|
224
224
|
|
225
225
|
# @return [Float] the absolute angle of the angle in radians
|
226
226
|
def abs
|
227
|
-
@angle.abs
|
227
|
+
return @angle.abs
|
228
228
|
end
|
229
229
|
|
230
230
|
# @return [Float] angle as compass bearing in radians.
|
231
231
|
# Compass bearings are clockwise, Math angles are counter clockwise.
|
232
232
|
def to_bearing
|
233
|
-
self.class.new((Math::PI * 2) - @angle, true)
|
233
|
+
return self.class.new((Math::PI * 2) - @angle, true)
|
234
234
|
end
|
235
235
|
|
236
236
|
# @return [Float] the reverse angle in radians. i.e. angle + PI (or angle + 180 degrees)
|
data/lib/core_extensions.rb
CHANGED
@@ -25,7 +25,6 @@ class Numeric
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
alias to_r to_radians
|
29
28
|
alias to_rad to_radians
|
30
29
|
alias to_deg to_degrees
|
31
30
|
|
@@ -35,25 +34,6 @@ class Numeric
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
|
-
# Alters round method to have an optional number of decimal places.
|
39
|
-
class Float
|
40
|
-
# Replace default round, so we can reference it later.
|
41
|
-
# @return [Float]
|
42
|
-
alias round0 round
|
43
|
-
|
44
|
-
# Compatible Replacement for Float.round
|
45
|
-
# @return [Float] float rounded to n decimal places.
|
46
|
-
# @param [Numeric] n Optional argument n is the number of decimal places to round to.
|
47
|
-
def round(n = 0)
|
48
|
-
if n == 0
|
49
|
-
self.round0 # This is to preserve the default behaviour, which is to return a Fixnum, not a float.
|
50
|
-
else
|
51
|
-
m = 10.0**n
|
52
|
-
(self * m).round0 / m
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
37
|
# Extends String to to_dec_degrees, add to_r and to_d
|
58
38
|
class String
|
59
39
|
# string expected to be degrees, returns decimal degrees.
|
@@ -93,6 +73,5 @@ class String
|
|
93
73
|
end
|
94
74
|
|
95
75
|
alias to_rad to_radians
|
96
|
-
alias to_r to_radians
|
97
76
|
alias to_deg to_degrees
|
98
77
|
end
|
data/lib/vincenty.rb
CHANGED
@@ -12,7 +12,7 @@ require_relative 'coordinate.rb'
|
|
12
12
|
# Modified to incorporate corrections to formulae as found in script on http://www.movable-type.co.uk/scripts/LatLongVincenty.html
|
13
13
|
# Added my Modification of the distanceAndAngle formulae to correct the compass bearing.
|
14
14
|
class Vincenty < Coordinate
|
15
|
-
VERSION = '1.0.
|
15
|
+
VERSION = '1.0.10'
|
16
16
|
|
17
17
|
# @return [String] constant VERSION
|
18
18
|
def version
|