ruby-processing 2.4.3 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/CHANGELOG +5 -0
  4. data/README.md +4 -2
  5. data/lib/ruby-processing/exporters/application_exporter.rb +1 -0
  6. data/lib/ruby-processing/version.rb +1 -1
  7. data/library/boids/boids.rb +14 -13
  8. data/library/vecmath/lib/vec.rb +20 -4
  9. data/samples/contributed/circle_collision.rb +92 -149
  10. data/samples/contributed/drawolver.rb +13 -27
  11. data/samples/contributed/elegant_ball.rb +158 -0
  12. data/samples/contributed/fern.rb +16 -3
  13. data/samples/contributed/flight_patterns.rb +16 -4
  14. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/bumpy_surface_noise.rb +4 -9
  15. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/data/java_args.txt +0 -0
  16. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/library/custom_shape/custom_shape.rb +1 -1
  17. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/library/particle_system/particle_system.rb +7 -10
  18. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/library/surface/surface.rb +2 -2
  19. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/liquidy.rb +7 -7
  20. data/samples/external_library/java_processing/{pbox2d → box2d_processing}/polygons.rb +4 -9
  21. data/samples/external_library/java_processing/custom/README.md +15 -0
  22. data/samples/external_library/java_processing/custom/Rakefile +28 -0
  23. data/samples/external_library/java_processing/custom/landscape.rb +58 -0
  24. data/samples/external_library/java_processing/custom/src/nn/Connection.java +47 -0
  25. data/samples/external_library/java_processing/custom/src/nn/HiddenNeuron.java +20 -0
  26. data/samples/external_library/java_processing/custom/src/nn/InputNeuron.java +23 -0
  27. data/samples/external_library/java_processing/custom/src/nn/Network.java +136 -0
  28. data/samples/external_library/java_processing/custom/src/nn/Neuron.java +79 -0
  29. data/samples/external_library/java_processing/custom/src/nn/OutputNeuron.java +7 -0
  30. data/samples/external_library/java_processing/custom/xor.rb +88 -0
  31. data/samples/external_library/ruby_gem/README +1 -1
  32. data/samples/external_library/ruby_gem/data/data.json +8 -0
  33. data/samples/external_library/ruby_gem/draw_test.rb +171 -0
  34. data/samples/processing_app/basics/form/icosahedra.rb +39 -0
  35. data/samples/processing_app/basics/form/library/icosahedron/icosahedron.rb +60 -0
  36. data/samples/processing_app/basics/form/toroid.rb +78 -92
  37. data/samples/processing_app/basics/transform/birds.rb +6 -12
  38. data/samples/processing_app/basics/transform/cubes_in_cube.rb +25 -22
  39. data/samples/processing_app/basics/transform/library/cube/cube.rb +16 -16
  40. data/samples/processing_app/basics/transform/rotate_push_pop.rb +1 -1
  41. data/samples/processing_app/demos/graphics/bezier_patch.rb +18 -31
  42. data/samples/processing_app/demos/graphics/trefoil.rb +15 -15
  43. data/samples/processing_app/library/vecmath/acceleration_with_vectors.rb +3 -3
  44. data/samples/processing_app/library/vecmath/hilbert_fractal.rb +2 -2
  45. data/samples/processing_app/library/vecmath/library/flock/flock.rb +18 -21
  46. data/samples/processing_app/library/vecmath/library/hilbert/hilbert.rb +11 -8
  47. data/samples/processing_app/library/vecmath/library/wiggler/wiggler.rb +7 -15
  48. data/samples/processing_app/library/vecmath/seeking_neural.rb +172 -0
  49. data/samples/processing_app/topics/animation/animated_sprite.rb +5 -8
  50. data/samples/processing_app/topics/animation/sequential.rb +2 -3
  51. data/samples/processing_app/topics/create_shapes/library/particle/particle_system.rb +7 -7
  52. data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +2 -2
  53. data/samples/processing_app/topics/create_shapes/wiggle_pshape.rb +2 -1
  54. data/samples/processing_app/topics/lsystems/koch.rb +1 -1
  55. data/samples/processing_app/topics/lsystems/library/koch/koch_fractal.rb +24 -23
  56. data/samples/processing_app/topics/motion/circle_collision.rb +117 -160
  57. data/samples/processing_app/topics/motion/library/cube/cube.rb +1 -1
  58. data/samples/processing_app/topics/motion/morph.rb +1 -1
  59. data/samples/processing_app/topics/motion/reflection1.rb +17 -16
  60. data/samples/processing_app/topics/shaders/conway.rb +2 -2
  61. data/samples/processing_app/topics/shaders/data/conway.glsl +10 -10
  62. data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +9 -8
  63. data/samples/processing_app/topics/shaders/landscape.rb +1 -1
  64. data/samples/processing_app/topics/simulate/flocking.rb +1 -1
  65. data/samples/processing_app/topics/simulate/library/flock/flock.rb +62 -57
  66. data/samples/processing_app/topics/simulate/multiple_particle_systems.rb +8 -28
  67. data/samples/processing_app/topics/simulate/simple_particle_system.rb +9 -7
  68. data/samples/processing_app/topics/simulate/smoke_particle_system.rb +12 -11
  69. data/vendors/Rakefile +2 -2
  70. metadata +26 -21
  71. data/samples/contributed/pong.rb +0 -177
  72. data/samples/contributed/simple_buffer.rb +0 -44
  73. data/samples/external_library/java_processing/pbox2d/contact_test.rb +0 -23
  74. data/samples/processing_app/basics/form/icosahedra/icosahedra.rb +0 -72
  75. data/samples/processing_app/basics/form/icosahedra/icosahedron.rb +0 -116
  76. data/samples/processing_app/basics/form/icosahedra/shape_3D.rb +0 -25
@@ -1,6 +1,6 @@
1
1
  require 'rake/clean'
2
2
 
3
- JRUBY_VERSION = "1.7.11"
3
+ JRUBY_VERSION = "1.7.12"
4
4
 
5
5
  CLOBBER.include("jruby-complete-#{JRUBY_VERSION}.jar")
6
6
 
@@ -12,7 +12,7 @@ task :download => ["jruby-complete-#{JRUBY_VERSION}.jar"]
12
12
 
13
13
  file "jruby-complete-#{JRUBY_VERSION}.jar" do
14
14
  sh "wget http://jruby.org.s3.amazonaws.com/downloads/#{JRUBY_VERSION}/jruby-complete-#{JRUBY_VERSION}.jar"
15
- check_sha1("jruby-complete-#{JRUBY_VERSION}.jar", "cf627710faa842c9ea9f1e9955866703c653c5d9")
15
+ check_sha1("jruby-complete-#{JRUBY_VERSION}.jar", "a63380de1a30534184ae52c419a67a7ea43f45d3")
16
16
  end
17
17
 
18
18
  directory "../lib/ruby"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2014-02-25 00:00:00.000000000 Z
21
+ date: 2014-04-15 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: bundler
@@ -134,6 +134,7 @@ files:
134
134
  - samples/contributed/bezier_playground.rb
135
135
  - samples/contributed/circle_collision.rb
136
136
  - samples/contributed/drawolver.rb
137
+ - samples/contributed/elegant_ball.rb
137
138
  - samples/contributed/empathy.rb
138
139
  - samples/contributed/fern.rb
139
140
  - samples/contributed/fibonacci_sphere.rb
@@ -145,13 +146,28 @@ files:
145
146
  - samples/contributed/jwishy.rb
146
147
  - samples/contributed/mandelbrot.rb
147
148
  - samples/contributed/orbit.rb
148
- - samples/contributed/pong.rb
149
149
  - samples/contributed/quadraticvertex.rb
150
150
  - samples/contributed/re_sample.rb
151
151
  - samples/contributed/reflection.rb
152
- - samples/contributed/simple_buffer.rb
153
152
  - samples/contributed/tree.rb
154
153
  - samples/external_library/java_processing/README
154
+ - samples/external_library/java_processing/box2d_processing/bumpy_surface_noise.rb
155
+ - samples/external_library/java_processing/box2d_processing/data/java_args.txt
156
+ - samples/external_library/java_processing/box2d_processing/library/custom_shape/custom_shape.rb
157
+ - samples/external_library/java_processing/box2d_processing/library/particle_system/particle_system.rb
158
+ - samples/external_library/java_processing/box2d_processing/library/surface/surface.rb
159
+ - samples/external_library/java_processing/box2d_processing/liquidy.rb
160
+ - samples/external_library/java_processing/box2d_processing/polygons.rb
161
+ - samples/external_library/java_processing/custom/README.md
162
+ - samples/external_library/java_processing/custom/Rakefile
163
+ - samples/external_library/java_processing/custom/landscape.rb
164
+ - samples/external_library/java_processing/custom/src/nn/Connection.java
165
+ - samples/external_library/java_processing/custom/src/nn/HiddenNeuron.java
166
+ - samples/external_library/java_processing/custom/src/nn/InputNeuron.java
167
+ - samples/external_library/java_processing/custom/src/nn/Network.java
168
+ - samples/external_library/java_processing/custom/src/nn/Neuron.java
169
+ - samples/external_library/java_processing/custom/src/nn/OutputNeuron.java
170
+ - samples/external_library/java_processing/custom/xor.rb
155
171
  - samples/external_library/java_processing/fisica/README
156
172
  - samples/external_library/java_processing/fisica/bubbles.rb
157
173
  - samples/external_library/java_processing/fisica/joints.rb
@@ -174,19 +190,6 @@ files:
174
190
  - samples/external_library/java_processing/hemesh/library/vbo/mesh_to_vbo.rb~
175
191
  - samples/external_library/java_processing/hemesh/twin_iso.rb
176
192
  - samples/external_library/java_processing/hemesh/twin_iso.rb~
177
- - samples/external_library/java_processing/pbox2d/bumpy_surface_noise.rb
178
- - samples/external_library/java_processing/pbox2d/contact_test.rb
179
- - samples/external_library/java_processing/pbox2d/contact_test.rb~
180
- - samples/external_library/java_processing/pbox2d/data/java_args.txt
181
- - samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb
182
- - samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb~
183
- - samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb
184
- - samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb~
185
- - samples/external_library/java_processing/pbox2d/library/surface/surface.rb
186
- - samples/external_library/java_processing/pbox2d/library/surface/surface.rb~
187
- - samples/external_library/java_processing/pbox2d/liquidy.rb
188
- - samples/external_library/java_processing/pbox2d/liquidy.rb~
189
- - samples/external_library/java_processing/pbox2d/polygons.rb
190
193
  - samples/external_library/java_processing/peasy_cam/hello_peasy.rb
191
194
  - samples/external_library/java_processing/peasy_cam/hilbert_fractal.rb
192
195
  - samples/external_library/java_processing/peasy_cam/library/hilbert/hilbert.rb
@@ -202,7 +205,9 @@ files:
202
205
  - samples/external_library/java_processing/toxiclibs/model_align.rb
203
206
  - samples/external_library/ruby_gem/README
204
207
  - samples/external_library/ruby_gem/data/README.txt
208
+ - samples/external_library/ruby_gem/data/data.json
205
209
  - samples/external_library/ruby_gem/data/java_args.txt
210
+ - samples/external_library/ruby_gem/draw_test.rb
206
211
  - samples/external_library/ruby_gem/game_of_life.rb
207
212
  - samples/external_library/ruby_gem/mdarray_test.rb
208
213
  - samples/processing_app/ABOUT
@@ -237,9 +242,8 @@ files:
237
242
  - samples/processing_app/basics/form/bezier_ellipse.rb
238
243
  - samples/processing_app/basics/form/brick_tower.rb
239
244
  - samples/processing_app/basics/form/cubic_grid.rb
240
- - samples/processing_app/basics/form/icosahedra/icosahedra.rb
241
- - samples/processing_app/basics/form/icosahedra/icosahedron.rb
242
- - samples/processing_app/basics/form/icosahedra/shape_3D.rb
245
+ - samples/processing_app/basics/form/icosahedra.rb
246
+ - samples/processing_app/basics/form/library/icosahedron/icosahedron.rb
243
247
  - samples/processing_app/basics/form/pie_chart.rb
244
248
  - samples/processing_app/basics/form/points_lines.rb
245
249
  - samples/processing_app/basics/form/primitives.rb
@@ -426,6 +430,7 @@ files:
426
430
  - samples/processing_app/library/vecmath/retained_menger.rb
427
431
  - samples/processing_app/library/vecmath/retained_test.rb
428
432
  - samples/processing_app/library/vecmath/retained_test2.rb
433
+ - samples/processing_app/library/vecmath/seeking_neural.rb
429
434
  - samples/processing_app/library/vecmath/simple_particle_system.rb
430
435
  - samples/processing_app/library/vecmath/smoke_particle_system.rb
431
436
  - samples/processing_app/library/vecmath/vector_math.rb
@@ -863,7 +868,7 @@ requirements:
863
868
  - java runtime >= 1.6+
864
869
  - processing = 2.0.3+
865
870
  rubyforge_project:
866
- rubygems_version: 2.2.0
871
+ rubygems_version: 2.2.2
867
872
  signing_key:
868
873
  specification_version: 4
869
874
  summary: Code as Art, Art as Code. Processing and Ruby are meant for each other.
@@ -1,177 +0,0 @@
1
- # Simple pong clone to demonstrate keyboard input and basic collision detection
2
- # Left paddle is controlled with 'a' and 'z', right with ''' and '/'
3
-
4
- def setup
5
- size 800, 400
6
- ellipse_mode(CENTER)
7
- no_fill
8
- stroke(255)
9
- frame_rate(60)
10
- @left_paddle = Paddle.new(width / 4, height / 2)
11
- @right_paddle = Paddle.new(width / 4 * 3, height / 2)
12
- @ball = Ball.new(width / 2, height / 2)
13
- end
14
-
15
- def draw
16
- background(0)
17
-
18
- paddles.each { |paddle| paddle.update }
19
-
20
- @ball.collide_with_boundaries
21
- paddles.each { |paddle| @ball.collide_with_paddle(paddle) }
22
- @ball.move
23
-
24
- paddles.each { |paddle| paddle.draw }
25
- @ball.draw
26
- end
27
-
28
- def paddles
29
- return @left_paddle, @right_paddle
30
- end
31
-
32
- def key_pressed
33
- case key
34
- when 'a' then @left_paddle.direction = -1
35
- when 'z' then @left_paddle.direction = 1
36
- when '\'' then @right_paddle.direction = -1
37
- when '/' then @right_paddle.direction = 1
38
- end
39
- end
40
-
41
- def key_released
42
- case key
43
- when 'a', 'z' then @left_paddle.direction = 0
44
- when '\'', '/' then @right_paddle.direction = 0
45
- end
46
- end
47
-
48
- class Paddle
49
- attr_accessor :position, :radius, :direction, :width, :height, :speed
50
-
51
- def initialize(x, y)
52
- @width, @height = $app.width, $app.height
53
- @position = Vector.new(x, y)
54
- @radius = 20
55
- @direction = 0
56
- @speed = 2
57
- end
58
-
59
- def draw
60
- stroke_weight(2)
61
- ellipse(position.x, position.y, radius * 2, radius * 2)
62
- end
63
-
64
- def update
65
- move
66
- collide_with_boundaries
67
- end
68
-
69
- def move
70
- @position.y += direction * speed
71
- end
72
-
73
- def collide_with_boundaries
74
- @position.y = position.y < radius ? radius : position.y > height - radius ? height - radius : position.y
75
- end
76
- end
77
-
78
- class Ball
79
- attr_accessor :position, :velocity, :radius, :width, :height
80
-
81
- def initialize(x, y)
82
- @width, @height = $app.width, $app.height
83
- @position = Vector.new(x, y)
84
- @velocity = Vector.new(2, 0)
85
- @radius = 5
86
- end
87
-
88
- def draw
89
- stroke_weight(1)
90
- ellipse(position.x, position.y, radius * 2, radius * 2)
91
- end
92
-
93
- def move
94
- @position += velocity
95
- end
96
-
97
- def collide_with_boundaries
98
- if position.x <= radius || position.x >= width - radius
99
- velocity.x *= -1
100
- elsif position.y <= radius || position.y >= height - radius
101
- velocity.y *= -1
102
- end
103
- end
104
-
105
- def collide_with_paddle(paddle)
106
- # Check for collision
107
- distance_vector = position - paddle.position
108
- return unless distance_vector.squared_length <= (radius + paddle.radius) ** 2
109
-
110
- # Calculate new velocity
111
- normal = distance_vector.normal.normalized
112
- @velocity = normal * (velocity * normal) * 2 - velocity
113
-
114
- # Move ball to correct position
115
- @position = paddle.position + distance_vector.normalized * (2 * (radius + paddle.radius) - distance_vector.length)
116
- end
117
- end
118
-
119
-
120
- #####################################################################
121
- # Vector class only for illustration you could use PVector instead
122
- #####################################################################
123
- class Vector
124
- attr_accessor :x, :y
125
-
126
- def initialize(x, y)
127
- @x, @y = x, y
128
- end
129
-
130
- def +(other)
131
- if other.is_a?(Numeric)
132
- Vector.new(x + other, y + other)
133
- elsif other.is_a?(Vector)
134
- Vector.new(x + other.x, y + other.y)
135
- else
136
- self
137
- end
138
- end
139
-
140
- def -(other)
141
- if other.is_a?(Numeric)
142
- Vector.new(x - other, y - other)
143
- elsif other.is_a?(Vector)
144
- Vector.new(x - other.x, y - other.y)
145
- else
146
- self
147
- end
148
- end
149
-
150
- def *(other)
151
- if other.is_a?(Numeric)
152
- Vector.new(x * other, y * other)
153
- elsif other.is_a?(Vector)
154
- x * other.x + y * other.y
155
- else
156
- self
157
- end
158
- end
159
-
160
- def length
161
- sqrt(x * x + y * y)
162
- end
163
-
164
- def squared_length
165
- x * x + y * y
166
- end
167
-
168
- def normal
169
- Vector.new(-y, x)
170
- end
171
-
172
- def normalized
173
- length = self.length
174
- Vector.new(x / length, y / length)
175
- end
176
- end
177
-
@@ -1,44 +0,0 @@
1
-
2
- def setup
3
-
4
- # With Processing, buffers allow you to draw off-screen to an image,
5
- # and then use that image in your sketch. This can speed up rendering
6
- # times quite a bit, as it's not only faster to draw off-screen, but
7
- # it also allows you to redraw only portions of the screen.
8
-
9
- # Ruby-Processing provides a convenience method, "buffer", which
10
- # sets up a buffer for you with the same width and height and
11
- # renderer as the current sketch, and yields it to you. It also
12
- # takes care of calling begin_draw and end_draw at the start and
13
- # end of the block. Use it like so:
14
- size 800, 800, P2D
15
- @buffer = buffer do |b|
16
- b.no_stroke
17
- b.fill 255, 0, 0
18
- b.rect 100, 200, 100, 100
19
- end
20
-
21
- # Those lines are equivalent to the following lines:
22
-
23
- @buffer_2 = create_graphics(500, 500, P2D)
24
- @buffer_2.begin_draw
25
- @buffer_2.no_stroke
26
- @buffer_2.fill(255, 0, 0)
27
- @buffer_2.rect(100, 200, 100, 100)
28
- @buffer_2.end_draw
29
-
30
- # If you'd like to set the size or renderer for the buffer block,
31
- # just pass it in like normal:
32
-
33
- @buffer_3 = buffer(150, 150, P2D) do |b|
34
- # b.whatever goes here.
35
- end
36
-
37
- # And now we go ahead and grab the rendered image from the first buffer.
38
- @img = @buffer.get(0, 0, @buffer.width, @buffer.height)
39
- end
40
-
41
- def draw
42
- background 0
43
- image @img, frame_count, 0
44
- end
@@ -1,23 +0,0 @@
1
- load_library 'jbox2d'
2
- require 'jruby/core_ext'
3
- class JContactListener
4
- include org.jbox2d.callbacks.ContactListener
5
-
6
- def initialize()
7
- end
8
- java_signature "void beginContact(org.jbox2d.dynamics.contacts.Contact c)"
9
- def begin_contact(c)
10
- end
11
- java_signature "void endContact(org.jbox2d.dynamics.contacts.Contact c)"
12
- def end_contact(c)
13
- end
14
- java_signature "void beginContact(org.jbox2d.dynamics.contacts.Contact,org.jbox2d.callbacks.ContactImpulse )"
15
- def pre_solve(c, ci)
16
- end
17
- java_signature "void beginContact(org.jbox2d.dynamics.contacts.Contact,org.jbox2d.callbacks.ContactImpulse )"
18
- def post_solve(c, ci)
19
- end
20
- end
21
-
22
-
23
-
@@ -1,72 +0,0 @@
1
- # I Like Icosahedra
2
- # by Ira Greenberg.
3
- #
4
- # This example plots icosahedra. The Icosahdron is a regular
5
- # polyhedron composed of twenty equalateral triangles.
6
-
7
- # fjenett, 2010-03-11:
8
- # This is by far not an exact translation of Iras code. I removed
9
- # the unneeded Dimension3D class, simplyfied Shape3D and improved
10
- # the Icosahedron class. That and the rubyfication ...
11
- require './icosahedron' # load icosahedron.rb
12
-
13
-
14
-
15
- def setup
16
-
17
- size 640, 360, P3D
18
-
19
- @ico1 = Icosahedron.new 75
20
- @ico2 = Icosahedron.new 75
21
- @ico3 = Icosahedron.new 75
22
-
23
- end
24
-
25
- def draw
26
-
27
- background 0
28
- lights
29
-
30
- translate width/2, height/2
31
-
32
- push_matrix
33
-
34
- translate -width/3.5, 0
35
- rotate_x frame_count * PI / 185
36
- rotate_y frame_count * PI / -200
37
-
38
- stroke 170, 0, 0
39
- no_fill
40
-
41
- @ico1.draw
42
-
43
- pop_matrix
44
-
45
- push_matrix
46
-
47
- rotate_x frame_count * PI / 200
48
- rotate_y frame_count * PI / 300
49
-
50
- stroke 170, 0, 180
51
- fill 170, 170, 0
52
-
53
- @ico2.draw
54
-
55
- pop_matrix
56
-
57
- push_matrix
58
-
59
- translate width/3.5, 0
60
- rotate_x frame_count * PI / -200
61
- rotate_y frame_count * PI / 200
62
-
63
- no_stroke
64
- fill 0, 0, 185
65
-
66
- @ico3.draw
67
-
68
- pop_matrix
69
-
70
- end
71
-
72
-