gray_scott_gtk3 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -31
- data/gray_scott_gtk3.gemspec +1 -1
- data/lib/gray_scott/color.rb +21 -13
- data/lib/gray_scott/model.rb +0 -1
- data/lib/gray_scott/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d6144fd61b89a4f478d3551ed4648ce9fe10bba4b6c61b0dcb40aa596c21d82
|
4
|
+
data.tar.gz: 8cb60d9a0a48f7abbaae085fc11e8d1347d39879108ca904d0d809b464dedef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '099e6543d57bdd095f6ff28ee74291dbca5ab089a07d7b304c9b91afe28583d2f71686fb66f97f8434c3e9b4ddeb5544890b6ac9b710944c8c3c04e0a24887ba'
|
7
|
+
data.tar.gz: 629899205425c0d7caab3c62f4adeec2e6694d66fa33bd22e6674045c787c02ce40f065855785a42a1515a5803bbf687477843d18b53885036af920c5f54c1a7
|
data/README.md
CHANGED
@@ -1,46 +1,31 @@
|
|
1
1
|
# Gray-Scott
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
## Requirements
|
3
|
+
Ruby implementation of the Reaction diffusion system (Gray-Scott model).
|
6
4
|
|
7
|
-
|
8
|
-
* Numo/NArray (CPU)
|
9
|
-
* Cumo/NArray (GPU)
|
10
|
-
* Ruby/Gtk3
|
5
|
+
![screenshot](https://raw.githubusercontent.com/kojix2/Gray-Scott/screenshot/screenshot/screenshot.gif)
|
11
6
|
|
12
7
|
## Installation
|
13
8
|
|
14
|
-
|
9
|
+
```bash
|
10
|
+
gem install gray_scott_gtk3
|
11
|
+
```
|
15
12
|
|
16
13
|
## Usage
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
## Usage with terminal(example)
|
23
|
-
|
24
|
-
$ bundle install
|
25
|
-
|
26
|
-
$ bundle exec bin/console
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
c = GrayScott::Controller.new 'resources/', width:1024, height:1024
|
15
|
+
```bash
|
16
|
+
grayscott
|
17
|
+
```
|
30
18
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
c.model.f = f
|
38
|
-
c.model.k = k
|
39
|
-
c.model.v.rand(0.0, 0.15)
|
40
|
-
c.color = 'reverse_green' # colorful is slow.
|
41
|
-
Gtk.main
|
19
|
+
```bash
|
20
|
+
grayscott --help
|
21
|
+
# Usage: grayscott [options]
|
22
|
+
# -h, --height val height of the model
|
23
|
+
# -w, --width val width of the model
|
24
|
+
# -g, --gpu use GPU(Cumo)
|
42
25
|
```
|
43
26
|
|
27
|
+
NOTE : You can set the width and height of the model, but the width and height of the window is fixed at 512 x 512 pixels.
|
28
|
+
|
44
29
|
![screenshot](https://raw.githubusercontent.com/kojix2/Gray-Scott/screenshot/screenshot/reverse-green.png)
|
45
30
|
|
46
31
|
## Known issue
|
data/gray_scott_gtk3.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'gtk3'
|
25
25
|
spec.add_dependency 'numo-narray'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
29
29
|
spec.add_development_dependency 'rspec'
|
30
30
|
end
|
data/lib/gray_scott/color.rb
CHANGED
@@ -25,23 +25,31 @@ module GrayScott
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
# speed
|
29
|
+
def uInt8_dstack(ar)
|
30
|
+
x = UInt8.zeros(*ar[0].shape, 3)
|
31
|
+
x[true, true, 0] = ar[0]
|
32
|
+
x[true, true, 1] = ar[1]
|
33
|
+
x[true, true, 2] = ar[2]
|
34
|
+
x
|
35
|
+
end
|
36
|
+
|
28
37
|
def hsv2rgb(h)
|
29
|
-
height, width = h.shape
|
30
38
|
i = UInt8.cast(h * 6)
|
31
39
|
f = (h * 6.0) - i
|
32
|
-
p = UInt8.zeros
|
33
|
-
v = UInt8.new(
|
40
|
+
p = UInt8.zeros *h.shape
|
41
|
+
v = UInt8.new(*h.shape).fill 255
|
34
42
|
q = (1.0 - f) * 256
|
35
43
|
t = f * 256
|
36
|
-
rgb = UInt8.zeros
|
37
|
-
t = UInt8.cast(t)
|
38
|
-
i =
|
39
|
-
rgb[i.eq 0] =
|
40
|
-
rgb[i.eq 1] =
|
41
|
-
rgb[i.eq 2] =
|
42
|
-
rgb[i.eq 3] =
|
43
|
-
rgb[i.eq 4] =
|
44
|
-
rgb[i.eq 5] =
|
44
|
+
rgb = UInt8.zeros *h.shape, 3
|
45
|
+
t = UInt8.cast(t)
|
46
|
+
i = uInt8_dstack([i, i, i])
|
47
|
+
rgb[i.eq 0] = uInt8_dstack([v, t, p])[i.eq 0]
|
48
|
+
rgb[i.eq 1] = uInt8_dstack([q, v, p])[i.eq 1]
|
49
|
+
rgb[i.eq 2] = uInt8_dstack([p, v, t])[i.eq 2]
|
50
|
+
rgb[i.eq 3] = uInt8_dstack([p, q, v])[i.eq 3]
|
51
|
+
rgb[i.eq 4] = uInt8_dstack([t, p, v])[i.eq 4]
|
52
|
+
rgb[i.eq 5] = uInt8_dstack([v, p, q])[i.eq 5]
|
45
53
|
rgb
|
46
54
|
end
|
47
55
|
|
@@ -71,7 +79,7 @@ module GrayScott
|
|
71
79
|
|
72
80
|
def grayscale(ar)
|
73
81
|
d = ar * 255
|
74
|
-
UInt8.dstack([d,d,d])
|
82
|
+
UInt8.dstack([d, d, d])
|
75
83
|
end
|
76
84
|
|
77
85
|
private
|
data/lib/gray_scott/model.rb
CHANGED
data/lib/gray_scott/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gray_scott_gtk3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gtk3
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
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: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.0.
|
127
|
+
rubygems_version: 3.0.3
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Gray-Scott model.
|