vector_salad 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/.yardopts +1 -0
- data/README.md +1 -0
- data/lib/contracts_contracts.rb +4 -4
- data/lib/vector_salad/standard_shapes/circle.rb +3 -1
- data/lib/vector_salad/version.rb +1 -1
- data/vector_salad.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a6b0ecd1d24e4cdd933aef2c98e31528254e440
|
4
|
+
data.tar.gz: 9a7b1e683c59cd59328dec8ab937b7b35c68d734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a35a54a39d8c2dc0c2afc31821412ea4d11c2539cddf330155fa696f1aa544d7b3119eb8302896bb75ff65929216d35ca2e4ca639e20e2db99e02f51f133c50
|
7
|
+
data.tar.gz: 26fb55040ca5a28ce3a656e3c8da13a032e1fa293a7bb7aa33676acaabcf6255ab397f75ba2140a3a2a04153a58aeb304f18d30c2453f2cdaebb7d6493a98d7b
|
data/.travis.yml
ADDED
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# VectorSalad
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/vector_salad.svg)](http://badge.fury.io/rb/vector_salad)
|
4
|
+
[![Build Status](https://travis-ci.org/sfcgeorge/vector_salad.svg)](https://travis-ci.org/sfcgeorge/vector_salad)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/sfcgeorge/vector_salad/badges/gpa.svg)](https://codeclimate.com/github/sfcgeorge/vector_salad)
|
5
6
|
[![Documentation](https://img.shields.io/badge/yard-docs-blue.svg?style=flat)](http://sfcgeorge.github.io/vector_salad/doc/)
|
6
7
|
|
data/lib/contracts_contracts.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Contracts
|
3
3
|
class Coords
|
4
4
|
def self.valid?(val)
|
5
|
-
Maybe[[Num, Num]].valid? val
|
5
|
+
Contracts::Maybe[[Contracts::Num, Contracts::Num]].valid? val
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.to_s
|
@@ -12,7 +12,7 @@ module Contracts
|
|
12
12
|
|
13
13
|
class Coord
|
14
14
|
def self.valid?(val)
|
15
|
-
Num.valid? val
|
15
|
+
Contracts::Num.valid? val
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.to_s
|
@@ -22,11 +22,11 @@ module Contracts
|
|
22
22
|
|
23
23
|
class PolySides
|
24
24
|
def self.valid?(val)
|
25
|
-
|
25
|
+
val && val.is_a?(Integer) && val >= 3
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.to_s
|
29
|
-
"
|
29
|
+
"Int; sides of the polygon, minimum of 3"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -23,10 +23,12 @@ module VectorSalad
|
|
23
23
|
|
24
24
|
# Convert the shape to a path
|
25
25
|
def to_path
|
26
|
+
# Standard:
|
26
27
|
# http://stackoverflow.com/a/13338311
|
27
28
|
# c = 4 * (Math.sqrt(2) - 1) / 3
|
28
29
|
# c = 0.5522847498307936
|
29
30
|
#
|
31
|
+
# Better:
|
30
32
|
# http://spencermortensen.com/articles/bezier-circle/
|
31
33
|
c = 0.551915024494
|
32
34
|
d = c * @radius
|
@@ -51,7 +53,7 @@ module VectorSalad
|
|
51
53
|
# Flatten the circle into many small straight line segments.
|
52
54
|
#
|
53
55
|
# @param fn The number of segments
|
54
|
-
Contract Maybe[
|
56
|
+
Contract Maybe[PolySides] => Path
|
55
57
|
def to_simple_path(fn = nil)
|
56
58
|
fn ||= (@radius * 4).ceil
|
57
59
|
|
data/lib/vector_salad/version.rb
CHANGED
data/vector_salad.gemspec
CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency "pretty_backtrace", "~> 0.1"
|
26
26
|
spec.add_dependency "ruby_clipper", "~> 5.0"
|
27
|
-
spec.add_dependency "spiro", "~> 0.
|
28
|
-
spec.add_dependency "contracts", "~> 0.
|
27
|
+
spec.add_dependency "spiro", "~> 0.3"
|
28
|
+
spec.add_dependency "contracts", "~> 0.12"
|
29
29
|
|
30
30
|
#spec.add_development_dependency "yard", "~> 0.8"
|
31
31
|
#spec.add_development_dependency "yard-contracts"#, "~> 0.1"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vector_salad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon George
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: contracts
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.12'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.12'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,6 +107,7 @@ extensions: []
|
|
107
107
|
extra_rdoc_files: []
|
108
108
|
files:
|
109
109
|
- ".gitignore"
|
110
|
+
- ".travis.yml"
|
110
111
|
- ".yardopts"
|
111
112
|
- Gemfile
|
112
113
|
- LICENSE.txt
|