vector_salad 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vector_salad/standard_shapes/heart.rb +31 -0
- data/lib/vector_salad/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d071854e1ae66458871e4835ff4722769d12c828
|
4
|
+
data.tar.gz: df18b372b8c248e804d46c32cd1db9aae11f7920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501f23219b15b3f4889a14bda93af31cc03f9c3c4dc7bc7b59a8759c5203c454deec4d5d4d3b2ffc358c35d7b3e8a4ad55fc5b5681bc06201c80107ab405d136
|
7
|
+
data.tar.gz: 9bd797ceebdb158c2f0ebd9b8a4ce9e616ce127c6990112370fcc94edfab329f1e7985eb9abff39614b4f86a6b467d83dc1f6195c2037a39c28244a88a25a307
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "vector_salad/standard_shapes/polygon"
|
2
|
+
|
3
|
+
module VectorSalad
|
4
|
+
module StandardShapes
|
5
|
+
class Heart < BasicShape
|
6
|
+
# Create a perfect heart
|
7
|
+
Contract Pos, {} => Heart
|
8
|
+
def initialize(size, **options)
|
9
|
+
r = size / 4 # two circles next to each other
|
10
|
+
r2 = Math.sqrt(2 * r**2)
|
11
|
+
the_little_bit = r2 - r
|
12
|
+
the_long_one = size + 2 * the_little_bit
|
13
|
+
l = Math.sqrt(the_long_one**2 / 2) - r
|
14
|
+
|
15
|
+
@shape = Union.new(**options) do
|
16
|
+
circle(r)[-r, 0]
|
17
|
+
circle(r)[r, 0]
|
18
|
+
difference do
|
19
|
+
square(l)[-l/2, -l/2].rotate(45).move(0, r2 / 2)
|
20
|
+
square(l * 2)[-l, -l * 2]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_path
|
27
|
+
@shape
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/vector_salad/version.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon George
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- lib/vector_salad/standard_shapes/difference.rb
|
218
218
|
- lib/vector_salad/standard_shapes/exclusion.rb
|
219
219
|
- lib/vector_salad/standard_shapes/flip.rb
|
220
|
+
- lib/vector_salad/standard_shapes/heart.rb
|
220
221
|
- lib/vector_salad/standard_shapes/hexagon.rb
|
221
222
|
- lib/vector_salad/standard_shapes/intersection.rb
|
222
223
|
- lib/vector_salad/standard_shapes/iso_tri.rb
|