terraformer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/lib/terraformer/point.rb +15 -0
- data/lib/terraformer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a38c82fa80e7028497825a3a76854c5f9586d231
|
4
|
+
data.tar.gz: 76c876c284220886fd12d03b7ddb0899e3f19a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63541a7ea29f76a55919544db5dfbb6f6e3c129d92b2750e53196309762c67832af11f62d514a6217b33a43224974a44c87fa5fc7551be97d6d1388f6a96f4aa
|
7
|
+
data.tar.gz: 19dfe889e98da966a2d2c509f9bfcd22975bad4ca227dc46abc389beafcef12c6e4832e36dc5d419d0d8746e6bbfc820a81f8cc1adde4b1c4b5a798489f981a9
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/lib/terraformer/point.rb
CHANGED
@@ -2,6 +2,10 @@ module Terraformer
|
|
2
2
|
|
3
3
|
class Point < Geometry
|
4
4
|
|
5
|
+
DEFAULT_RANDOM_POINTS = 10
|
6
|
+
DEFAULT_RANDOM_DELTA = 0.05 # degrees
|
7
|
+
DEFAULT_RANDOM_ROUND = 5
|
8
|
+
|
5
9
|
def initialize *args
|
6
10
|
super
|
7
11
|
|
@@ -84,6 +88,17 @@ module Terraformer
|
|
84
88
|
end
|
85
89
|
end
|
86
90
|
|
91
|
+
def random_points n = DEFAULT_RANDOM_POINTS,
|
92
|
+
delta = DEFAULT_RANDOM_DELTA,
|
93
|
+
round = DEFAULT_RANDOM_ROUND
|
94
|
+
s = ->{rand(2) * 2 - 1} # -1 or 1
|
95
|
+
Array.new(n) do
|
96
|
+
x = (coordinates.x + s[] * rand() * delta).round(round)
|
97
|
+
y = (coordinates.y + s[] * rand() * delta).round(round)
|
98
|
+
Terraformer::Point.new x, y
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
87
102
|
end
|
88
103
|
|
89
104
|
end
|
data/lib/terraformer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraformer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi Nakamura
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: launchy
|