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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef4f58211b0ab0cd8b0bbc3fdab15dadc240f4f2fb9cb4b22d6d49d85e696d7a
4
- data.tar.gz: d0d8fc77fae048d5fd9250805cf202c4e35a9d5799c26a3ae5ad65f8e87c90c3
3
+ metadata.gz: 2d6144fd61b89a4f478d3551ed4648ce9fe10bba4b6c61b0dcb40aa596c21d82
4
+ data.tar.gz: 8cb60d9a0a48f7abbaae085fc11e8d1347d39879108ca904d0d809b464dedef9
5
5
  SHA512:
6
- metadata.gz: 57eb46e7262c6fa35cd4937bb849731c685bdb312f0c5066ee71c51a87bced2709fbae0428aa2040ae1c492f8f663596989dcbff82612df93fb430bde934356d
7
- data.tar.gz: 56fe55ecdf81df295cae9c1e02f48839c403abb2586d82cfefcb918a5308eada89625b788dc0dec772f0b6bce1924015aff720f5c423997dc2881657660cab61
6
+ metadata.gz: '099e6543d57bdd095f6ff28ee74291dbca5ab089a07d7b304c9b91afe28583d2f71686fb66f97f8434c3e9b4ddeb5544890b6ac9b710944c8c3c04e0a24887ba'
7
+ data.tar.gz: 629899205425c0d7caab3c62f4adeec2e6694d66fa33bd22e6674045c787c02ce40f065855785a42a1515a5803bbf687477843d18b53885036af920c5f54c1a7
data/README.md CHANGED
@@ -1,46 +1,31 @@
1
1
  # Gray-Scott
2
2
 
3
- ![screenshot](https://raw.githubusercontent.com/kojix2/Gray-Scott/screenshot/screenshot/screenshot.gif)
4
-
5
- ## Requirements
3
+ Ruby implementation of the Reaction diffusion system (Gray-Scott model).
6
4
 
7
- * Ruby
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
- $ gem install gray_scott_gtk3
9
+ ```bash
10
+ gem install gray_scott_gtk3
11
+ ```
15
12
 
16
13
  ## Usage
17
14
 
18
- $ grayscott
19
-
20
- $ grayscott -w 256 -h 256 # size of model. display is fixed to 512 x 512 pixels.
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
- # custom feed / kill ratio
32
- na = Numo::SFloat.new(1024,1).seq + 10 # avoid zero
33
- na = na * Numo::SFloat.ones(1, 1024)
34
- na = na / na.max
35
- f = na * 0.05
36
- k = na.transpose * 0.06 + 0.01
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
@@ -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', '~> 1.17'
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
@@ -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 height, width, 1
33
- v = UInt8.new(height, width, 1).fill 255
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 height, width, 3
37
- t = UInt8.cast(t).expand_dims(2)
38
- i = UInt8.dstack([i, i, i])
39
- rgb[i.eq 0] = UInt8.dstack([v, t, p])[i.eq 0]
40
- rgb[i.eq 1] = UInt8.dstack([q, v, p])[i.eq 1]
41
- rgb[i.eq 2] = UInt8.dstack([p, v, t])[i.eq 2]
42
- rgb[i.eq 3] = UInt8.dstack([p, q, v])[i.eq 3]
43
- rgb[i.eq 4] = UInt8.dstack([t, p, v])[i.eq 4]
44
- rgb[i.eq 5] = UInt8.dstack([v, p, q])[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
@@ -1,5 +1,4 @@
1
1
  module GrayScott
2
-
3
2
  # Gray-Scott model
4
3
  class Model
5
4
  include XumoShortHand
@@ -1,3 +1,3 @@
1
1
  module GrayScott
2
- VERSION = '0.5.3'.freeze
2
+ VERSION = '0.5.4'.freeze
3
3
  end
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.3
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-01-08 00:00:00.000000000 Z
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: '1.17'
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: '1.17'
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.1
127
+ rubygems_version: 3.0.3
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: Gray-Scott model.