gray_scott_gtk3 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +5 -1
- data/.rspec +3 -0
- data/Gemfile +2 -2
- data/README.md +1 -1
- data/Rakefile +6 -2
- data/bin/console +3 -3
- data/exe/grayscott +15 -5
- data/gray_scott_gtk3.gemspec +16 -17
- data/lib/gray_scott_gtk3.rb +6 -6
- data/lib/gray_scott_gtk3/controller.rb +9 -20
- data/lib/gray_scott_gtk3/controller/aboutdialog.rb +15 -0
- data/lib/gray_scott_gtk3/model.rb +2 -2
- data/lib/gray_scott_gtk3/version.rb +1 -1
- data/resources/gray_scott.glade +3 -3
- data/screenshot/screenshot.gif +0 -0
- metadata +20 -18
- data/Gemfile.lock +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc4073fb80e208c5af63ea40b5c05d9b4078a2e8a05f5c9e9c8a13b73d20b5a6
|
4
|
+
data.tar.gz: f97b366371ea21e8316a70b72a3330694eca1a056b97ea794bca9286bfac3709
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98317af10dfa5bcf97960e01d0a4f6216c42f9c7378b082203819685e2710a581da72fcb39c9d8561a5c731996fe7fd9d857bd23cb1407213acdcbf55f6e19d9
|
7
|
+
data.tar.gz: 12344e46949d46085c9c9710811848320106228bf5a630ac6a819516430f9f747b3020911b9918e86b830bcae816e9809c07707bec3bf005a346085d1ba9df8a
|
data/.gitignore
CHANGED
@@ -43,9 +43,13 @@ build-iPhoneSimulator/
|
|
43
43
|
|
44
44
|
# for a library or gem, you might want to ignore these files since the code is
|
45
45
|
# intended to run in multiple environments; otherwise, check them in:
|
46
|
-
|
46
|
+
Gemfile.lock
|
47
47
|
# .ruby-version
|
48
48
|
# .ruby-gemset
|
49
49
|
|
50
50
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
51
|
.rvmrc
|
52
|
+
|
53
|
+
# rspec
|
54
|
+
/spec/reports/
|
55
|
+
.rspec_status
|
data/.rspec
ADDED
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in gray_scott_gtk3.gemspec
|
6
6
|
gemspec
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'gray_scott_gtk3'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "gray_scott_gtk3"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/exe/grayscott
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'gray_scott_gtk3'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
opt = {}
|
7
|
+
OptionParser.new do |op|
|
8
|
+
op.banner += ' msec'
|
9
|
+
op.on('-h val', '--height', 'height of the model') { |v| opt[:height] = v.to_i }
|
10
|
+
op.on('-w val', '--width', 'width of the model') { |v| opt[:width] = v.to_i }
|
11
|
+
op.version = GrayScottGtk3::VERSION
|
12
|
+
op.parse!(ARGV)
|
13
|
+
end
|
4
14
|
|
5
15
|
if ARGV[0]
|
6
16
|
module GrayScottGtk3
|
@@ -11,13 +21,13 @@ else
|
|
11
21
|
exit
|
12
22
|
end
|
13
23
|
|
14
|
-
module GrayScottGtk3
|
24
|
+
module GrayScottGtk3
|
15
25
|
class << self
|
16
|
-
def run
|
26
|
+
def run(opt)
|
17
27
|
xml_path = File.expand_path('../resources/', __dir__)
|
18
|
-
Controller.new
|
28
|
+
Controller.new(xml_path, opt)
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
22
32
|
|
23
|
-
GrayScottGtk3.run
|
33
|
+
GrayScottGtk3.run(opt)
|
data/gray_scott_gtk3.gemspec
CHANGED
@@ -1,31 +1,30 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require 'gray_scott_gtk3/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'gray_scott_gtk3'
|
8
7
|
spec.version = GrayScottGtk3::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
8
|
+
spec.authors = ['kojix2']
|
9
|
+
spec.email = ['2xijok@gmail.com']
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
11
|
+
spec.summary = 'Gray-Scott model.'
|
12
|
+
spec.description = 'Reaction diffusion system (Gray-Scott model).'
|
13
|
+
spec.homepage = 'https://github.com/kojix2/Gray-Scott'
|
15
14
|
|
16
15
|
# Specify which files should be added to the gem when it is released.
|
17
16
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path(
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
18
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
19
|
end
|
21
|
-
spec.bindir =
|
20
|
+
spec.bindir = 'exe'
|
22
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ['lib']
|
24
23
|
|
25
|
-
spec.add_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency "gtk3"
|
24
|
+
spec.add_dependency 'numo-narray'
|
25
|
+
spec.add_dependency 'gtk3'
|
28
26
|
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec'
|
31
30
|
end
|
data/lib/gray_scott_gtk3.rb
CHANGED
@@ -2,12 +2,12 @@ require 'numo/narray'
|
|
2
2
|
require 'gtk3'
|
3
3
|
|
4
4
|
module ShortNumo
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
N = Numo
|
6
|
+
class Numo::SFloat
|
7
|
+
alias _ inplace
|
8
|
+
end
|
9
|
+
SFloat = Numo::SFloat
|
10
|
+
UInt8 = Numo::UInt8
|
11
11
|
end
|
12
12
|
|
13
13
|
require 'gray_scott_gtk3/model'
|
@@ -1,14 +1,16 @@
|
|
1
|
+
require_relative 'controller/aboutdialog'
|
2
|
+
|
1
3
|
module GrayScottGtk3
|
2
4
|
class Controller
|
3
5
|
include ShortNumo
|
4
6
|
attr_accessor :resource_dir, :height, :width, :model
|
5
7
|
|
6
|
-
def initialize(dir)
|
8
|
+
def initialize(dir, height: 256, width: 256)
|
7
9
|
@resource_dir = dir
|
8
|
-
@height =
|
9
|
-
@width =
|
10
|
+
@height = height
|
11
|
+
@width = width
|
10
12
|
@model = Model.new(height: height, width: width)
|
11
|
-
@show_u =
|
13
|
+
@show_u = false
|
12
14
|
@color = 'colorful'
|
13
15
|
|
14
16
|
builder = Gtk::Builder.new
|
@@ -21,17 +23,12 @@ module GrayScottGtk3
|
|
21
23
|
builder.connect_signals { |handler| method(handler) }
|
22
24
|
|
23
25
|
@win.show_all # window
|
26
|
+
on_new_clicked
|
24
27
|
Gtk.main
|
25
28
|
end
|
26
29
|
|
27
30
|
def show_about
|
28
|
-
|
29
|
-
a.program_name = 'Gray-Scott'
|
30
|
-
a.logo = GdkPixbuf::Pixbuf.new(file: File.join(resource_dir, 'about_icon.png'))
|
31
|
-
a.authors = ['kojix2']
|
32
|
-
a.version = GrayScottGtk3::VERSION
|
33
|
-
a.run
|
34
|
-
a.destroy
|
31
|
+
AboutDialog.new resource_dir
|
35
32
|
end
|
36
33
|
|
37
34
|
def on_f_changed(f)
|
@@ -91,14 +88,6 @@ module GrayScottGtk3
|
|
91
88
|
|
92
89
|
def on_new_clicked
|
93
90
|
model.clear
|
94
|
-
if @show_u && !@doing_now
|
95
|
-
dialog = Gtk::MessageDialog.new(message: 'display V density',
|
96
|
-
type: :info,
|
97
|
-
tutton_type: :close)
|
98
|
-
dialog.run
|
99
|
-
@uv_combobox.active = 1 # v
|
100
|
-
dialog.destroy
|
101
|
-
end
|
102
91
|
display_legend
|
103
92
|
display
|
104
93
|
end
|
@@ -118,7 +107,7 @@ module GrayScottGtk3
|
|
118
107
|
x = e.x * width / 512
|
119
108
|
y = e.y * height / 512
|
120
109
|
r = @pen_radius.value
|
121
|
-
if x > r && y > r && x < (
|
110
|
+
if x > r && y > r && x < (width - 1 - r) && y < (height - 1 - r)
|
122
111
|
model.v[(y - r)..(y + r), (x - r)..(x + r)] = @pen_density.value
|
123
112
|
end
|
124
113
|
display unless doing_now?
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GrayScottGtk3
|
2
|
+
class Controller
|
3
|
+
class AboutDialog
|
4
|
+
def initialize(resource_dir)
|
5
|
+
@a = Gtk::AboutDialog.new
|
6
|
+
@a.program_name = 'Gray-Scott'
|
7
|
+
@a.logo = GdkPixbuf::Pixbuf.new(file: File.join(resource_dir, 'about_icon.png'))
|
8
|
+
@a.authors = ['kojix2']
|
9
|
+
@a.version = GrayScottGtk3::VERSION
|
10
|
+
@a.run
|
11
|
+
@a.destroy
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -30,8 +30,8 @@ module GrayScottGtk3
|
|
30
30
|
l_v = SFloat._laplacian2d v, Dx
|
31
31
|
|
32
32
|
uvv = u * v * v
|
33
|
-
dudt = Du * l_u - uvv +
|
34
|
-
dvdt = Dv * l_v + uvv - (
|
33
|
+
dudt = Du * l_u - uvv + f * (1.0 - u)
|
34
|
+
dvdt = Dv * l_v + uvv - (f + k) * v
|
35
35
|
u._ + (Dt * dudt)
|
36
36
|
v._ + (Dt * dvdt)
|
37
37
|
end
|
data/resources/gray_scott.glade
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<!-- Generated with glade 3.22.1 -->
|
3
3
|
<interface>
|
4
|
-
<requires lib="gtk+" version="3.
|
4
|
+
<requires lib="gtk+" version="3.16"/>
|
5
5
|
<object class="GtkAdjustment" id="f">
|
6
6
|
<property name="upper">0.10000000000000001</property>
|
7
7
|
<property name="value">0.040000000000000001</property>
|
@@ -142,7 +142,7 @@
|
|
142
142
|
<property name="can_focus">True</property>
|
143
143
|
<property name="receives_default">True</property>
|
144
144
|
<property name="use_stock">True</property>
|
145
|
-
<property name="image_position">
|
145
|
+
<property name="image_position">top</property>
|
146
146
|
<property name="always_show_image">True</property>
|
147
147
|
<signal name="clicked" handler="on_new_clicked" swapped="no"/>
|
148
148
|
</object>
|
@@ -293,7 +293,7 @@
|
|
293
293
|
<object class="GtkComboBoxText" id="uv_combobox">
|
294
294
|
<property name="visible">True</property>
|
295
295
|
<property name="can_focus">False</property>
|
296
|
-
<property name="active">
|
296
|
+
<property name="active">1</property>
|
297
297
|
<items>
|
298
298
|
<item translatable="yes">U</item>
|
299
299
|
<item translatable="yes">V</item>
|
Binary file
|
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rsvg2
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: gtk3
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +66,21 @@ dependencies:
|
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '10.0'
|
83
|
-
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Reaction diffusion system (Gray-Scott model).
|
84
84
|
email:
|
85
85
|
- 2xijok@gmail.com
|
86
86
|
executables:
|
@@ -89,8 +89,8 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
+
- ".rspec"
|
92
93
|
- Gemfile
|
93
|
-
- Gemfile.lock
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
96
|
- bin/console
|
@@ -99,11 +99,13 @@ files:
|
|
99
99
|
- gray_scott_gtk3.gemspec
|
100
100
|
- lib/gray_scott_gtk3.rb
|
101
101
|
- lib/gray_scott_gtk3/controller.rb
|
102
|
+
- lib/gray_scott_gtk3/controller/aboutdialog.rb
|
102
103
|
- lib/gray_scott_gtk3/laplacian.rb
|
103
104
|
- lib/gray_scott_gtk3/model.rb
|
104
105
|
- lib/gray_scott_gtk3/version.rb
|
105
106
|
- resources/about_icon.png
|
106
107
|
- resources/gray_scott.glade
|
108
|
+
- screenshot/screenshot.gif
|
107
109
|
- screenshot/screenshot.png
|
108
110
|
homepage: https://github.com/kojix2/Gray-Scott
|
109
111
|
licenses: []
|
data/Gemfile.lock
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
gray_scott_gtk3 (0.3.0)
|
5
|
-
gtk3
|
6
|
-
numo-narray
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
atk (3.3.0)
|
12
|
-
glib2 (= 3.3.0)
|
13
|
-
cairo (1.16.2)
|
14
|
-
native-package-installer (>= 1.0.3)
|
15
|
-
pkg-config (>= 1.2.2)
|
16
|
-
cairo-gobject (3.3.0)
|
17
|
-
cairo (>= 1.16.1)
|
18
|
-
glib2 (= 3.3.0)
|
19
|
-
gdk3 (3.3.0)
|
20
|
-
cairo-gobject (= 3.3.0)
|
21
|
-
gdk_pixbuf2 (= 3.3.0)
|
22
|
-
pango (= 3.3.0)
|
23
|
-
gdk_pixbuf2 (3.3.0)
|
24
|
-
gio2 (= 3.3.0)
|
25
|
-
gio2 (3.3.0)
|
26
|
-
glib2 (= 3.3.0)
|
27
|
-
gobject-introspection (= 3.3.0)
|
28
|
-
glib2 (3.3.0)
|
29
|
-
native-package-installer (>= 1.0.3)
|
30
|
-
pkg-config (>= 1.2.2)
|
31
|
-
gobject-introspection (3.3.0)
|
32
|
-
glib2 (= 3.3.0)
|
33
|
-
gtk3 (3.3.0)
|
34
|
-
atk (= 3.3.0)
|
35
|
-
gdk3 (= 3.3.0)
|
36
|
-
gdk_pixbuf2 (= 3.3.0)
|
37
|
-
gio2 (= 3.3.0)
|
38
|
-
pango (= 3.3.0)
|
39
|
-
native-package-installer (1.0.6)
|
40
|
-
numo-narray (0.9.1.3)
|
41
|
-
pango (3.3.0)
|
42
|
-
cairo-gobject (= 3.3.0)
|
43
|
-
gobject-introspection (= 3.3.0)
|
44
|
-
pkg-config (1.3.2)
|
45
|
-
rake (10.5.0)
|
46
|
-
|
47
|
-
PLATFORMS
|
48
|
-
ruby
|
49
|
-
|
50
|
-
DEPENDENCIES
|
51
|
-
bundler (~> 1.17)
|
52
|
-
gray_scott_gtk3!
|
53
|
-
rake (~> 10.0)
|
54
|
-
|
55
|
-
BUNDLED WITH
|
56
|
-
1.17.1
|