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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8870157d8b1074418f97a8760cece253047829e0
4
- data.tar.gz: de0f63a4d2a320e9e3c8a2c5b70025d2208a56fc
3
+ metadata.gz: a38c82fa80e7028497825a3a76854c5f9586d231
4
+ data.tar.gz: 76c876c284220886fd12d03b7ddb0899e3f19a37
5
5
  SHA512:
6
- metadata.gz: 252e0d88535889c9bc9fe641bba534917288d77412b86db9de20a99fecfdd422ef245f6e2b8cbefc16cc69001726084d4633847d284aed1ab522bea4b2dc4954
7
- data.tar.gz: c92efd04400e6a059fae22304b6d6f7b7344a79ffa530fd3a1dff08aa58e4690588c0c986bc765c7fb364ff255a09ebb755e150749f8f8cd4a32fa2e4b62158f
6
+ metadata.gz: 63541a7ea29f76a55919544db5dfbb6f6e3c129d92b2750e53196309762c67832af11f62d514a6217b33a43224974a44c87fa5fc7551be97d6d1388f6a96f4aa
7
+ data.tar.gz: 19dfe889e98da966a2d2c509f9bfcd22975bad4ca227dc46abc389beafcef12c6e4832e36dc5d419d0d8746e6bbfc820a81f8cc1adde4b1c4b5a798489f981a9
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  changelog
2
2
  =========
3
3
 
4
+ ### 0.2.1 5 may 2015
5
+
6
+ * add `Point.random_points`
7
+
4
8
  ### 0.2.0 3 feb 2015
5
9
 
6
10
  thanks: @davy
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem 'launchy', '~>2.4', require: nil
4
4
 
5
5
  group :test do
6
6
  gem 'httpclient', '~>2.5'
7
+ gem 'minitest-autotest', '~>1.0'
7
8
  gem 'pry', '~>0.10'
8
9
  gem 'pry-nav', '~>0.2'
9
10
  gem 'ruby-prof', '~>0.15'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Terraformer
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: terraformer
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
  - Kenichi Nakamura
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-03 00:00:00.000000000 Z
12
+ date: 2015-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: launchy