ruby-processing 2.6.2 → 2.6.3

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rpextras.jar +0 -0
  3. data/lib/ruby-processing.rb +5 -8
  4. data/lib/ruby-processing/app.rb +26 -27
  5. data/lib/ruby-processing/config.rb +0 -2
  6. data/lib/ruby-processing/exporters/application_exporter.rb +1 -1
  7. data/lib/ruby-processing/exporters/base_exporter.rb +1 -1
  8. data/lib/ruby-processing/exporters/creator.rb +11 -11
  9. data/lib/ruby-processing/helper_methods.rb +33 -31
  10. data/lib/ruby-processing/helpers/numeric.rb +1 -1
  11. data/lib/ruby-processing/helpers/range.rb +11 -0
  12. data/lib/ruby-processing/library_loader.rb +11 -16
  13. data/lib/ruby-processing/runner.rb +22 -24
  14. data/lib/ruby-processing/runners/watch.rb +1 -1
  15. data/lib/ruby-processing/version.rb +1 -1
  16. data/library/boids/boids.rb +39 -70
  17. data/library/control_panel/control_panel.rb +3 -3
  18. data/samples/contributed/circle_collision.rb +3 -3
  19. data/samples/contributed/fern.rb +7 -10
  20. data/samples/contributed/fibonacci_sphere.rb +2 -2
  21. data/samples/contributed/full_screen.rb +23 -22
  22. data/samples/contributed/grapher.rb +3 -3
  23. data/samples/contributed/gravity.rb +1 -1
  24. data/samples/contributed/mandelbrot.rb +10 -13
  25. data/samples/external_library/java_processing/box2d_processing/bumpy_surface_noise.rb +1 -1
  26. data/samples/external_library/java_processing/box2d_processing/library/custom_shape/custom_shape.rb +2 -2
  27. data/samples/external_library/java_processing/box2d_processing/library/particle_system/particle_system.rb +1 -1
  28. data/samples/external_library/java_processing/box2d_processing/library/surface/surface.rb +2 -2
  29. data/samples/external_library/java_processing/box2d_processing/liquidy.rb +1 -1
  30. data/samples/external_library/java_processing/fisica/bubbles.rb +2 -2
  31. data/samples/external_library/java_processing/fisica/joints.rb +4 -4
  32. data/samples/external_library/java_processing/generative_design/node_spring_attractor.rb +2 -2
  33. data/samples/external_library/java_processing/geomerative/hello_world_rotate_firstletter.rb +7 -7
  34. data/samples/external_library/java_processing/hemesh/twin_iso.rb +3 -3
  35. data/samples/external_library/java_processing/pbox2d/bumpy_surface_noise.rb +1 -1
  36. data/samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb +2 -2
  37. data/samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb +1 -1
  38. data/samples/external_library/java_processing/pbox2d/library/surface/surface.rb +2 -2
  39. data/samples/external_library/java_processing/pbox2d/liquidy.rb +1 -1
  40. data/samples/external_library/java_processing/peasy_cam/library/hilbert/hilbert.rb +4 -4
  41. data/samples/external_library/ruby_gem/draw_test.rb +2 -2
  42. data/samples/external_library/ruby_gem/game_of_life.rb +3 -3
  43. data/samples/processing_app/basics/arrays/array_objects.rb +2 -2
  44. data/samples/processing_app/basics/color/hue.rb +1 -1
  45. data/samples/processing_app/basics/control/conditionals1.rb +5 -24
  46. data/samples/processing_app/basics/control/conditionals2.rb +1 -1
  47. data/samples/processing_app/basics/form/bezier_ellipse.rb +1 -1
  48. data/samples/processing_app/basics/form/brick_tower.rb +4 -8
  49. data/samples/processing_app/basics/form/regular_polygon.rb +1 -1
  50. data/samples/processing_app/basics/form/star.rb +1 -1
  51. data/samples/processing_app/basics/form/triangle_strip.rb +1 -1
  52. data/samples/processing_app/basics/input/storing_input.rb +1 -1
  53. data/samples/processing_app/basics/lights/spot.rb +1 -1
  54. data/samples/processing_app/basics/math/additive_wave.rb +2 -2
  55. data/samples/processing_app/basics/math/double_random.rb +2 -2
  56. data/samples/processing_app/basics/math/noise_wave.rb +1 -1
  57. data/samples/processing_app/basics/math/random.rb +1 -1
  58. data/samples/processing_app/basics/objects/module.rb +1 -1
  59. data/samples/processing_app/basics/objects/struct.rb +1 -1
  60. data/samples/processing_app/basics/structure/loop.rb +19 -14
  61. data/samples/processing_app/basics/structure/recursion2.rb +2 -2
  62. data/samples/processing_app/basics/textures/texture3.rb +13 -33
  63. data/samples/processing_app/basics/transform/birds.rb +5 -5
  64. data/samples/processing_app/basics/transform/cubes_in_cube.rb +3 -3
  65. data/samples/processing_app/basics/transform/rotate.rb +1 -1
  66. data/samples/processing_app/basics/typography/kinetic_type.rb +1 -1
  67. data/samples/processing_app/demos/graphics/bezier_patch.rb +34 -34
  68. data/samples/processing_app/demos/graphics/trefoil.rb +1 -1
  69. data/samples/processing_app/demos/graphics/wiggling.rb +5 -5
  70. data/samples/processing_app/demos/performance/esfera.rb +4 -4
  71. data/samples/processing_app/demos/performance/text_rendering.rb +1 -1
  72. data/samples/processing_app/library/dxf/simple_export.rb +3 -3
  73. data/samples/processing_app/library/pdf/complex_3D.rb +11 -11
  74. data/samples/processing_app/library/vecmath/vec2d/bouncing_ball.rb +1 -1
  75. data/samples/processing_app/library/vecmath/vec2d/circle_collision.rb +3 -3
  76. data/samples/processing_app/library/vecmath/vec2d/library/flock/flock.rb +5 -5
  77. data/samples/processing_app/library/vecmath/vec2d/library/particle/{particle_system.rb → particle.rb} +28 -21
  78. data/samples/processing_app/library/vecmath/vec2d/morph.rb +3 -3
  79. data/samples/processing_app/library/vecmath/vec2d/particle_system_pshape.rb +3 -3
  80. data/samples/processing_app/library/vecmath/vec2d/reflection1.rb +2 -2
  81. data/samples/processing_app/library/vecmath/vec2d/seeking_neural.rb +3 -2
  82. data/samples/processing_app/library/vecmath/vec2d/simple_particle_system.rb +1 -1
  83. data/samples/processing_app/library/vecmath/vec3d/frame_of_reference.rb +4 -4
  84. data/samples/processing_app/topics/advanced_data/library/word/word.rb +1 -1
  85. data/samples/processing_app/topics/advanced_data/load_save_XML.rb +1 -1
  86. data/samples/processing_app/topics/advanced_data/load_save_json.rb +1 -1
  87. data/samples/processing_app/topics/advanced_data/load_save_struct_yaml.rb +1 -1
  88. data/samples/processing_app/topics/advanced_data/load_save_yaml.rb +1 -1
  89. data/samples/processing_app/topics/advanced_data/threads_two.rb +1 -2
  90. data/samples/processing_app/topics/cellular_automata/game_of_life.rb +3 -3
  91. data/samples/processing_app/topics/cellular_automata/library/ca/ca.rb +2 -2
  92. data/samples/processing_app/topics/cellular_automata/library/cell/cell.rb +4 -4
  93. data/samples/processing_app/topics/cellular_automata/library/simple_cell/simple_cell.rb +1 -1
  94. data/samples/processing_app/topics/cellular_automata/spore1.rb +1 -1
  95. data/samples/processing_app/topics/cellular_automata/spore2.rb +1 -1
  96. data/samples/processing_app/topics/create_shapes/group_pshape.rb +2 -2
  97. data/samples/processing_app/topics/create_shapes/library/particle/particle_system.rb +3 -3
  98. data/samples/processing_app/topics/create_shapes/library/polygon/polygon.rb +2 -2
  99. data/samples/processing_app/topics/create_shapes/library/star/star.rb +3 -3
  100. data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +1 -1
  101. data/samples/processing_app/topics/create_shapes/path_pshape.rb +1 -1
  102. data/samples/processing_app/topics/drawing/scribble_plotter.rb +2 -2
  103. data/samples/processing_app/topics/gui/button.rb +16 -16
  104. data/samples/processing_app/topics/gui/rollover.rb +13 -13
  105. data/samples/processing_app/topics/image_processing/blur.rb +2 -2
  106. data/samples/processing_app/topics/image_processing/edge_detection.rb +2 -2
  107. data/samples/processing_app/topics/lsystems/cstest.rb +1 -1
  108. data/samples/processing_app/topics/lsystems/library/stochastic_grammar/stochastic_grammar.rb +1 -1
  109. data/samples/processing_app/topics/motion/bouncy_bubbles.rb +1 -1
  110. data/samples/processing_app/topics/motion/brownian.rb +2 -2
  111. data/samples/processing_app/topics/motion/circle_collision.rb +1 -1
  112. data/samples/processing_app/topics/motion/cubes_in_cube.rb +1 -1
  113. data/samples/processing_app/topics/motion/library/cube/cube.rb +2 -2
  114. data/samples/processing_app/topics/motion/morph.rb +11 -11
  115. data/samples/processing_app/topics/motion/moving_on_curves.rb +4 -4
  116. data/samples/processing_app/topics/motion/puff.rb +4 -4
  117. data/samples/processing_app/topics/motion/reflection1.rb +3 -3
  118. data/samples/processing_app/topics/motion/reflection2.rb +1 -1
  119. data/samples/processing_app/topics/shaders/bw_shader.rb +1 -1
  120. data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +2 -2
  121. data/samples/processing_app/topics/simulate/flocking.rb +6 -6
  122. data/samples/processing_app/topics/simulate/library/flock/flock.rb +33 -41
  123. data/samples/processing_app/topics/simulate/multiple_particle_systems.rb +34 -60
  124. data/samples/processing_app/topics/simulate/simple_particle_system.rb +20 -32
  125. data/samples/processing_app/topics/simulate/smoke_particle_system.rb +45 -57
  126. data/samples/processing_app/topics/simulate/springs.rb +40 -44
  127. metadata +4 -5
  128. data/samples/processing_app/library/vecmath/vec2d/multiple_particle_systems.rb +0 -141
  129. data/samples/processing_app/library/vecmath/vec2d/smoke_particle_system.rb +0 -133
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.6.2
4
+ version: 2.6.3
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-09-04 00:00:00.000000000 Z
21
+ date: 2014-09-15 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: bundler
@@ -113,6 +113,7 @@ files:
113
113
  - lib/ruby-processing/exporters/creator.rb
114
114
  - lib/ruby-processing/helper_methods.rb
115
115
  - lib/ruby-processing/helpers/numeric.rb
116
+ - lib/ruby-processing/helpers/range.rb
116
117
  - lib/ruby-processing/helpers/string.rb
117
118
  - lib/ruby-processing/library_loader.rb
118
119
  - lib/ruby-processing/runner.rb
@@ -444,16 +445,14 @@ files:
444
445
  - samples/processing_app/library/vecmath/vec2d/data/texture.png
445
446
  - samples/processing_app/library/vecmath/vec2d/flocking.rb
446
447
  - samples/processing_app/library/vecmath/vec2d/library/flock/flock.rb
447
- - samples/processing_app/library/vecmath/vec2d/library/particle/particle_system.rb
448
+ - samples/processing_app/library/vecmath/vec2d/library/particle/particle.rb
448
449
  - samples/processing_app/library/vecmath/vec2d/library/tile/tile.rb
449
450
  - samples/processing_app/library/vecmath/vec2d/morph.rb
450
- - samples/processing_app/library/vecmath/vec2d/multiple_particle_systems.rb
451
451
  - samples/processing_app/library/vecmath/vec2d/particle_system_pshape.rb
452
452
  - samples/processing_app/library/vecmath/vec2d/penrose.rb
453
453
  - samples/processing_app/library/vecmath/vec2d/reflection1.rb
454
454
  - samples/processing_app/library/vecmath/vec2d/seeking_neural.rb
455
455
  - samples/processing_app/library/vecmath/vec2d/simple_particle_system.rb
456
- - samples/processing_app/library/vecmath/vec2d/smoke_particle_system.rb
457
456
  - samples/processing_app/library/vecmath/vec2d/vector_math.rb
458
457
  - samples/processing_app/library/vecmath/vec2d/wiggle_pshape.rb
459
458
  - samples/processing_app/library/vecmath/vec3d/Rakefile
@@ -1,141 +0,0 @@
1
- # Ported from http://processing.org/learning/topics/multipleparticlesystems.html
2
-
3
- # Click the mouse to generate a burst of particles at mouse location.
4
-
5
- # Each burst is one instance of a particle system with Particles and
6
- # CrazyParticles (a subclass of Particle).
7
-
8
- require 'forwardable'
9
- load_library :vecmath
10
-
11
- module Runnable
12
- def run
13
- self.reject! { |item| item.dead? }
14
- self.each { |item| item.run }
15
- end
16
- end
17
-
18
- class ParticleSystem
19
- extend Forwardable
20
- def_delegators(:@particle_systems, :each, :<<, :reject!, :empty?)
21
- include Enumerable
22
- include Runnable
23
-
24
- attr_reader :particle_systems
25
-
26
- def initialize(number, origin)
27
- @particle_systems = []
28
- @origin = origin
29
- kind = rand < 0.5 ? Sketch::Particle : Sketch::CrazyParticle
30
- number.times { self << kind.new(origin) }
31
- end
32
-
33
- def dead?
34
- self.empty?
35
- end
36
- end
37
-
38
-
39
- def setup
40
- size 640, 580
41
- color_mode(RGB, 255, 255, 255, 100)
42
- ellipse_mode(CENTER)
43
- origin = rand(5 .. 16)
44
- start_pos = Vec2D.new(width / 2, height / 2)
45
- @particle_systems = ParticleSystem.new(origin, start_pos)
46
- end
47
-
48
- def draw
49
- background 0
50
- @particle_systems.run
51
- end
52
-
53
- def mouse_pressed
54
- origin = rand(5 .. 16)
55
- vector = Vec2D.new(mouse_x, mouse_y)
56
- @particle_systems << ParticleSystem.new(origin, vector)
57
- end
58
-
59
-
60
- class Particle
61
- attr_reader :velocity, :origin, :lifespan, :radius, :acceleration
62
- def initialize(origin)
63
- @origin = origin
64
- @velocity = Vec2D.new(rand(-1.0 .. 1), rand(-2.0 .. 0))
65
- @acceleration = Vec2D.new(0, 0.05)
66
- @radius = 10
67
- @lifespan = 100
68
- end
69
-
70
- def run
71
- update
72
- grow
73
- render
74
- render_velocity_vector
75
- end
76
-
77
- def update
78
- @velocity += acceleration
79
- @origin += velocity
80
- end
81
-
82
- def grow
83
- @lifespan -= 1
84
- end
85
-
86
- def dead?
87
- lifespan <= 0
88
- end
89
-
90
- def render
91
- stroke(255, lifespan)
92
- fill(100, lifespan)
93
- ellipse(origin.x, origin.y, radius, radius)
94
- end
95
-
96
- def render_velocity_vector
97
- scale = 10
98
- arrow_size = 4
99
- push_matrix
100
- translate(origin.x, origin.y)
101
- rotate(velocity.heading)
102
- length = velocity.mag * scale
103
- line 0, 0, length, 0
104
- line length, 0, length - arrow_size, arrow_size / 2
105
- line length, 0, length - arrow_size, -arrow_size / 2
106
- pop_matrix
107
- end
108
- end
109
-
110
-
111
- class CrazyParticle < Particle
112
- def initialize(origin)
113
- super
114
- @theta = 0
115
- end
116
-
117
- def run
118
- update
119
- grow
120
- render
121
- render_rotation_line
122
- end
123
-
124
- def update
125
- super
126
- @theta += velocity.x * velocity.mag / 10
127
- end
128
-
129
- def grow
130
- @lifespan -= 0.8
131
- end
132
-
133
- def render_rotation_line
134
- push_matrix
135
- translate(origin.x, origin.y)
136
- rotate(@theta)
137
- stroke(255, lifespan)
138
- line(0, 0, 25, 0)
139
- pop_matrix
140
- end
141
- end
@@ -1,133 +0,0 @@
1
- # Ported from http://processing.org/learning/topics/smokeparticlesystem.html
2
- # For some reason this sketch needs to be run with the --nojruby flag
3
- #
4
- # A ParticleSystem (Array) object manages a variable size list of
5
- # particles.
6
- require 'forwardable'
7
-
8
- load_library :vecmath
9
-
10
- attr_reader :ps, :img, :wind
11
-
12
- def setup
13
- size(640,360)
14
- @img = load_image("texture.png")
15
- @ps = ParticleSystem.new(0, Vec2D.new(width/2, height - 60), img)
16
- end
17
-
18
- def draw
19
- background(0)
20
- # Calculate a "wind" force based on mouse horizontal position
21
- dx = map(mouse_x, 0, width, -0.2, 0.2)
22
- @wind = Vec2D.new(dx, 0)
23
- ps.apply_force(wind)
24
- ps.run
25
- 2.times do
26
- ps.add_particle
27
- end
28
-
29
- # Draw a horizontal arrow representing the wind force
30
- draw_vector(wind, Vec2D.new(width / 2, 50), 500)
31
-
32
- end
33
-
34
- # Renders a vector object 'v' as an arrow and a location 'loc'
35
- def draw_vector(v, loc, scayl)
36
- push_matrix
37
- # Translate to location to render vector
38
- translate(loc.x, loc.y)
39
- rotate(v.heading)
40
- # Calculate length of vector & scale as necessary
41
- len = v.mag * scayl
42
- # Draw three lines to make an arrow
43
- arrowsize = 4
44
- stroke(255)
45
- stroke_weight 2
46
- line(0, 0, len, 0)
47
- stroke_weight 1
48
- line(len, 0, len - arrowsize, +arrowsize/2)
49
- line(len, 0, len - arrowsize, -arrowsize/2)
50
- pop_matrix
51
- end
52
-
53
- module Runnable
54
- def run
55
- self.reject! { |item| item.lifespan <= 0 }
56
- self.each { |item| item.run }
57
- end
58
- end
59
-
60
-
61
- class ParticleSystem
62
- extend Forwardable
63
- def_delegators(:@particles, :reject!, :<<, :each)
64
- include Enumerable
65
- include Runnable
66
-
67
- attr_reader :origin, :image, :generator
68
-
69
- def initialize(num, location, image)
70
- @particles = []
71
- @origin = location # no need for location.clone in ruby
72
- @image = image
73
- (0 ... num).each do
74
- particles << Particle.new(origin, image)
75
- end
76
- end
77
-
78
- def add_particle(p = Particle.new(origin, image))
79
- self << p
80
- end
81
-
82
- # Method to add a force vector to all particles currently in the system
83
- def apply_force(dir)
84
- self.each do |p|
85
- p.apply_force(dir)
86
- end
87
- end
88
- end
89
-
90
- # A simple Particle class
91
-
92
- class Particle
93
- include Processing::Proxy
94
-
95
- attr_reader :loc, :acc, :vel, :lifespan, :img, :generator
96
-
97
- def initialize(l, img_)
98
- @acc = Vec2D.new
99
- vx = random_gaussian * 0.3
100
- vy = random_gaussian * 0.3 - 1.0
101
- @vel = Vec2D.new(vx, vy)
102
- @loc = l # no need for l.clone in ruby
103
- @lifespan = 100.0
104
- @img = img_
105
- end
106
-
107
- def run
108
- update
109
- render
110
- end
111
-
112
- # Method to update location
113
- def update
114
- @vel += acc
115
- @loc += vel
116
- @lifespan -= 1.0
117
- end
118
-
119
- # Method to display
120
- def render
121
- image_mode(CENTER)
122
- tint(255,lifespan)
123
- image(img, loc.x, loc.y)
124
- end
125
-
126
- # Method to add a force vector to all particles currently in the system
127
- def apply_force(f)
128
- @acc += f
129
- end
130
-
131
- end
132
-
133
-