ruby-processing 1.0.9 → 1.0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/CHANGELOG +13 -1
  2. data/bin/rp5 +8 -2
  3. data/lib/core/core.jar +0 -0
  4. data/lib/core/jruby-complete.jar +0 -0
  5. data/lib/ruby-processing.rb +2 -2
  6. data/lib/ruby-processing/app.rb +108 -338
  7. data/lib/ruby-processing/config.rb +6 -0
  8. data/lib/ruby-processing/helper_methods.rb +120 -0
  9. data/lib/ruby-processing/library_loader.rb +140 -0
  10. data/lib/ruby-processing/runner.rb +34 -4
  11. data/lib/ruby-processing/runners/base.rb +10 -11
  12. data/lib/ruby-processing/runners/live.rb +1 -1
  13. data/lib/ruby-processing/runners/run.rb +1 -1
  14. data/lib/ruby-processing/runners/watch.rb +18 -76
  15. data/lib/templates/applet/index.html.erb +8 -9
  16. data/library/control_panel/control_panel.rb +1 -1
  17. data/library/dxf/library/dxf.jar +0 -0
  18. data/library/dxf/library/export.txt +1 -0
  19. data/library/javascript/library/export.txt +3 -1
  20. data/library/minim/library/export.txt +1 -0
  21. data/library/minim/library/jl1.0.jar +0 -0
  22. data/library/minim/library/jsminim.jar +0 -0
  23. data/library/minim/library/minim-spi.jar +0 -0
  24. data/library/minim/library/minim.jar +0 -0
  25. data/library/minim/library/mp3spi1.9.4.jar +0 -0
  26. data/library/minim/library/tritonus_aos.jar +0 -0
  27. data/library/minim/library/tritonus_share.jar +0 -0
  28. data/library/net/library/export.txt +1 -0
  29. data/library/net/library/net.jar +0 -0
  30. data/library/opengl/library/export.txt +7 -10
  31. data/library/opengl/library/gluegen-rt.jar +0 -0
  32. data/library/opengl/library/jogl.jar +0 -0
  33. data/library/opengl/library/{libgluegen-rt.so → linux32/libgluegen-rt.so} +0 -0
  34. data/library/opengl/library/{libjogl.so → linux32/libjogl.so} +0 -0
  35. data/library/opengl/library/{libjogl_awt.so → linux32/libjogl_awt.so} +0 -0
  36. data/library/opengl/library/{libjogl_cg.so → linux32/libjogl_cg.so} +0 -0
  37. data/library/opengl/library/linux64/libgluegen-rt.so +0 -0
  38. data/library/opengl/library/linux64/libjogl.so +0 -0
  39. data/library/opengl/library/linux64/libjogl_awt.so +0 -0
  40. data/library/opengl/library/linux64/libjogl_cg.so +0 -0
  41. data/library/opengl/library/{libgluegen-rt.jnilib → macosx/libgluegen-rt.jnilib} +0 -0
  42. data/library/opengl/library/{libjogl.jnilib → macosx/libjogl.jnilib} +0 -0
  43. data/library/opengl/library/{libjogl_awt.jnilib → macosx/libjogl_awt.jnilib} +0 -0
  44. data/library/opengl/library/{libjogl_cg.jnilib → macosx/libjogl_cg.jnilib} +0 -0
  45. data/library/opengl/library/opengl.jar +0 -0
  46. data/library/opengl/library/{gluegen-rt.dll → windows32/gluegen-rt.dll} +0 -0
  47. data/library/opengl/library/{jogl.dll → windows32/jogl.dll} +0 -0
  48. data/library/opengl/library/{jogl_awt.dll → windows32/jogl_awt.dll} +0 -0
  49. data/library/opengl/library/{jogl_cg.dll → windows32/jogl_cg.dll} +0 -0
  50. data/library/opengl/library/windows64/gluegen-rt.dll +0 -0
  51. data/library/opengl/library/windows64/jogl.dll +0 -0
  52. data/library/opengl/library/windows64/jogl_awt.dll +0 -0
  53. data/library/opengl/library/windows64/jogl_cg.dll +0 -0
  54. data/library/pdf/library/export.txt +1 -0
  55. data/library/pdf/library/itext.jar +0 -0
  56. data/library/pdf/library/pdf.jar +0 -0
  57. data/library/serial/library/RXTXcomm.jar +0 -0
  58. data/library/serial/library/export.txt +1 -3
  59. data/library/serial/library/linux32/librxtxSerial.so +0 -0
  60. data/library/serial/library/linux64/librxtxSerial.so +0 -0
  61. data/library/serial/library/macosx/librxtxSerial.jnilib +0 -0
  62. data/library/serial/library/serial.jar +0 -0
  63. data/library/serial/library/windows32/rxtxSerial.dll +0 -0
  64. data/library/serial/library/windows64/rxtxSerial.dll +0 -0
  65. data/library/video/library/export.txt +1 -0
  66. data/library/video/library/video.jar +0 -0
  67. data/samples/{animator.rb → contributed/animator.rb} +0 -0
  68. data/samples/{bezier_playground.rb → contributed/bezier_playground.rb} +0 -0
  69. data/samples/{circle_collision.rb → contributed/circle_collision.rb} +0 -0
  70. data/samples/contributed/drawolver.rb +182 -0
  71. data/samples/{empathy.rb → contributed/empathy.rb} +7 -7
  72. data/samples/{fern.rb → contributed/fern.rb} +0 -0
  73. data/samples/{flight_patterns.rb → contributed/flight_patterns.rb} +0 -0
  74. data/samples/{full_screen.rb → contributed/full_screen.rb} +0 -0
  75. data/samples/{getting_started.rb → contributed/getting_started.rb} +0 -0
  76. data/samples/{gravity.rb → contributed/gravity.rb} +0 -0
  77. data/samples/{jwishy.rb → contributed/jwishy.rb} +0 -0
  78. data/samples/{orbit.rb → contributed/orbit.rb} +0 -0
  79. data/samples/{pong.rb → contributed/pong.rb} +0 -0
  80. data/samples/{reflection.rb → contributed/reflection.rb} +0 -0
  81. data/samples/{simple_buffer.rb → contributed/simple_buffer.rb} +0 -0
  82. data/samples/{tree.rb → contributed/tree.rb} +0 -0
  83. data/samples/peasy_cam/library/hilbert/hilbert.rb +11 -10
  84. data/samples/processing_app/3D/camera/move_eye.rb +29 -0
  85. data/samples/processing_app/3D/form/brick_tower.rb +11 -11
  86. data/samples/processing_app/3D/form/cubic_grid.rb +51 -0
  87. data/samples/processing_app/3D/form/icosahedra/icosahedra.rb +76 -0
  88. data/samples/processing_app/3D/form/icosahedra/icosahedron.rb +116 -0
  89. data/samples/processing_app/3D/form/icosahedra/shape_3D.rb +25 -0
  90. data/samples/processing_app/3D/form/primitives.rb +42 -0
  91. data/samples/processing_app/3D/form/rgb_cube.rb +88 -0
  92. data/samples/processing_app/3D/form/shape_transform.rb +94 -0
  93. data/samples/processing_app/3D/form/toroid.rb +130 -0
  94. data/samples/processing_app/3D/form/vertices.rb +81 -0
  95. data/samples/processing_app/3D/image/data/eames.jpg +0 -0
  96. data/samples/processing_app/3D/image/data/ystone08.jpg +0 -0
  97. data/samples/processing_app/3D/image/explode.rb +56 -0
  98. data/samples/processing_app/3D/image/extrusion.rb +49 -0
  99. data/samples/processing_app/3D/image/zoom.rb +83 -0
  100. data/samples/processing_app/3D/lights/directional.rb +41 -0
  101. data/samples/processing_app/3D/lights/lights1.rb +39 -0
  102. data/samples/processing_app/3D/lights/lights2.rb +42 -0
  103. data/samples/processing_app/3D/lights/reflection.rb +38 -0
  104. data/samples/processing_app/3D/lights/spot.rb +39 -0
  105. data/samples/processing_app/3D/textures/data/berlin-1.jpg +0 -0
  106. data/samples/processing_app/3D/textures/texture1.rb +41 -0
  107. data/samples/processing_app/3D/textures/texture2.rb +38 -0
  108. data/samples/processing_app/3D/textures/texture3.rb +68 -0
  109. data/samples/processing_app/3D/textures/texture_cube.rb +106 -0
  110. data/samples/processing_app/3D/transform/bird.rb +61 -0
  111. data/samples/processing_app/3D/transform/birds/bird.rb +87 -0
  112. data/samples/processing_app/3D/transform/birds/birds.rb +48 -0
  113. data/samples/processing_app/3D/transform/cubes_in_cube/cube.rb +57 -0
  114. data/samples/processing_app/3D/transform/cubes_in_cube/cubes_in_cube.rb +102 -0
  115. data/samples/processing_app/3D/transform/push_pop_cubes.rb +152 -0
  116. data/samples/processing_app/3D/transform/rotate1.rb +43 -0
  117. data/samples/processing_app/3D/transform/rotate2.rb +45 -0
  118. data/samples/processing_app/3D/typography/data/Univers45.vlw +0 -0
  119. data/samples/processing_app/3D/typography/letter_k.rb +136 -0
  120. data/samples/processing_app/3D/typography/typing.rb +77 -0
  121. data/samples/processing_app/basics/form/triangle_strip.rb +19 -19
  122. data/samples/processing_app/basics/math/distance1.rb +59 -0
  123. data/samples/processing_app/basics/math/distance2.rb +38 -0
  124. data/samples/processing_app/basics/math/double_random.rb +38 -0
  125. data/samples/processing_app/basics/math/graphing_2_d_equation.rb +53 -0
  126. data/samples/processing_app/basics/math/increment_decrement.rb +59 -0
  127. data/samples/processing_app/basics/math/modulo.rb +43 -0
  128. data/samples/processing_app/basics/math/noise_1_d.rb +37 -0
  129. data/samples/processing_app/basics/math/noise_2_d.rb +47 -0
  130. data/samples/processing_app/basics/math/noise_3_d.rb +50 -0
  131. data/samples/processing_app/basics/math/noise_wave.rb +61 -0
  132. data/samples/processing_app/basics/math/operator_precedence.rb +70 -0
  133. data/samples/processing_app/basics/math/polar_to_cartesian.rb +44 -0
  134. data/samples/processing_app/basics/math/random.rb +35 -0
  135. data/samples/processing_app/basics/math/sine.rb +49 -0
  136. data/samples/processing_app/basics/math/sine_cosine.rb +60 -0
  137. data/samples/processing_app/basics/math/sine_wave.rb +62 -0
  138. data/samples/processing_app/basics/objects/composite_objects.rb +139 -0
  139. data/samples/processing_app/basics/objects/inheritance.rb +104 -0
  140. data/samples/processing_app/basics/objects/multiple_constructors.rb +66 -0
  141. data/samples/processing_app/basics/objects/objects.rb +72 -0
  142. data/samples/processing_app/basics/shape/data/bot1.svg +160 -0
  143. data/samples/processing_app/basics/shape/data/usa-wikipedia.svg +452 -0
  144. data/samples/processing_app/basics/shape/disable_style.rb +36 -0
  145. data/samples/processing_app/basics/shape/get_child.rb +43 -0
  146. data/samples/processing_app/basics/shape/load_display_shape.rb +33 -0
  147. data/samples/processing_app/basics/shape/scale_shape.rb +33 -0
  148. data/samples/processing_app/basics/structure/coordinates.rb +55 -0
  149. data/samples/processing_app/basics/structure/create_graphics.rb +39 -0
  150. data/samples/processing_app/basics/structure/functions.rb +41 -0
  151. data/samples/processing_app/basics/structure/loop.rb +39 -0
  152. data/samples/processing_app/basics/structure/noloop.rb +33 -0
  153. data/samples/processing_app/basics/structure/recursion1.rb +42 -0
  154. data/samples/processing_app/basics/structure/recursion2.rb +39 -0
  155. data/samples/processing_app/basics/structure/redraw.rb +36 -0
  156. data/samples/processing_app/basics/structure/setup_draw.rb +30 -0
  157. data/samples/processing_app/basics/structure/statements_comments.rb +32 -0
  158. data/samples/processing_app/basics/structure/width_height.rb +29 -0
  159. data/samples/processing_app/basics/transform/arm.rb +47 -0
  160. data/samples/processing_app/basics/transform/rotate.rb +43 -0
  161. data/samples/processing_app/basics/transform/scale.rb +45 -0
  162. data/samples/processing_app/basics/transform/translate.rb +41 -0
  163. data/samples/processing_app/basics/transform/triangle_flower.rb +69 -0
  164. data/samples/processing_app/basics/typography/data/CourierNew36.vlw +0 -0
  165. data/samples/processing_app/basics/typography/data/Ziggurat-HTF-Black-32.vlw +0 -0
  166. data/samples/processing_app/basics/typography/letters.rb +52 -0
  167. data/samples/processing_app/basics/typography/words.rb +37 -0
  168. data/samples/processing_app/basics/web/embedded_links.rb +58 -0
  169. data/samples/processing_app/basics/web/loading_images.rb +25 -0
  170. metadata +181 -86
  171. data/lib/patches/JRubyApplet.diff +0 -24
  172. data/lib/patches/PATCHES.txt +0 -3
  173. data/lib/patches/PApplet.diff +0 -27
  174. data/library/minim/license.txt +0 -339
  175. data/library/minim/version.txt +0 -1
  176. data/library/opengl/library/gluegen-rt-natives-linux-amd64.jar +0 -0
  177. data/library/opengl/library/gluegen-rt-natives-linux-i586.jar +0 -0
  178. data/library/opengl/library/gluegen-rt-natives-macosx-ppc.jar +0 -0
  179. data/library/opengl/library/gluegen-rt-natives-macosx-universal.jar +0 -0
  180. data/library/opengl/library/gluegen-rt-natives-windows-amd64.jar +0 -0
  181. data/library/opengl/library/gluegen-rt-natives-windows-i586.jar +0 -0
  182. data/library/opengl/library/gluegen-rt.jar.pack.gz +0 -0
  183. data/library/opengl/library/jogl-natives-linux-amd64.jar +0 -0
  184. data/library/opengl/library/jogl-natives-linux-i586.jar +0 -0
  185. data/library/opengl/library/jogl-natives-macosx-ppc.jar +0 -0
  186. data/library/opengl/library/jogl-natives-macosx-universal.jar +0 -0
  187. data/library/opengl/library/jogl-natives-windows-amd64.jar +0 -0
  188. data/library/opengl/library/jogl-natives-windows-i586.jar +0 -0
  189. data/library/opengl/library/jogl.jar.pack.gz +0 -0
  190. data/library/pdf/notes.txt +0 -8
  191. data/library/serial/library/librxtxSerial.jnilib +0 -0
  192. data/library/serial/library/librxtxSerial.so +0 -0
  193. data/library/serial/library/rxtxSerial.dll +0 -0
@@ -32,7 +32,7 @@
32
32
  #the_applet {
33
33
  margin: 0 auto;
34
34
  width: <%= @width.to_i %>px;
35
- padding: 6px;
35
+ padding: 6px;
36
36
  padding-top: 7px; padding-bottom: 2px;
37
37
  background: #262626 url(images/top.png) top left repeat-x;
38
38
  border: 1px solid #363636; border-top: 0;
@@ -48,7 +48,6 @@
48
48
  width: <%= [@width.to_i, 200].max - 16 %>px;
49
49
  padding: 7px 15px 7px 15px;
50
50
  background: #111;
51
- text-align: justify;
52
51
  margin: 0 auto;
53
52
  margin-top: 30px; margin-bottom: 10px;
54
53
  border: 1px solid #363636;
@@ -65,7 +64,7 @@
65
64
 
66
65
  <body>
67
66
  <div id="container">
68
-
67
+
69
68
  <div id="the_applet">
70
69
  <object
71
70
  type="application/x-java-applet"
@@ -73,7 +72,7 @@
73
72
  codebase="."
74
73
  style="margin: 0; padding: 0;"
75
74
  width="<%= @width %>" height="<%= @height %>">
76
-
75
+
77
76
  <param name="archive" value="<%= @file_list %>" />
78
77
  <param name="jruby.eval" value="ARGV[0] = '<%= @main_file %>'; require 'ruby-processing/runners/run.rb'" />
79
78
  <param name="image" value="images/ruby.jpg" />
@@ -82,18 +81,18 @@
82
81
  <param name="mayscript" value="true" />
83
82
  <param name="scriptable" value="true" />
84
83
  <param name="progressbar" value="true" />
85
-
84
+
86
85
  <% if @opengl %>
87
86
  <param name="codebase_lookup" value="false" />
88
87
  <param name="subapplet.classname" value="org.jruby.JRubyApplet" />
89
88
  <param name="subapplet.displayname" value="<%= @title %>" />
90
89
  <% end %>
91
-
90
+
92
91
  <!-- And if you don't have java. -->
93
92
  To view this content, you need to install Java from <a href="http://java.com">java.com</a>
94
93
  </object>
95
94
  </div>
96
-
95
+
97
96
  <div id="built_with">
98
97
  <a href="http://wiki.github.com/jashkenas/ruby-processing">
99
98
  <img src="images/built_with.jpg" alt="Ruby-Processing" />
@@ -101,14 +100,14 @@
101
100
  Via <a href="http://jruby.codehaus.org/">JRuby</a> and <a href="http://processing.org/">Processing</a><br />
102
101
  Source: <a href="<%= @main_file %>"><%= @main_file %></a>
103
102
  </div>
104
-
103
+
105
104
  <% if @description && !@description.empty? %>
106
105
  <div id="description">
107
106
  <h1><%= @title %></h1>
108
107
  <p><%= @description %></p>
109
108
  </div>
110
109
  <% end %>
111
-
110
+
112
111
  </div>
113
112
  </body>
114
113
  </html>
@@ -104,7 +104,7 @@ module ControlPanel
104
104
  set_resizable false
105
105
  # Need to wait for the sketch to finish sizing...
106
106
  Thread.new do
107
- sleep 0.2 while $app.default_size?
107
+ sleep 0.2 while !$app.started?
108
108
  set_location($app.width + 10, 0)
109
109
  show
110
110
  end
Binary file
@@ -0,0 +1 @@
1
+ name = DXF Export
@@ -1,6 +1,8 @@
1
+ name = JavaScript
2
+
1
3
  # don't actually export anything.. this is only to link against
2
4
  # inside of the p5 environment
3
5
  applet=
4
6
 
5
7
  # for an application, export to prevent from breaking
6
- application=javascript.jar
8
+ application=javascript.jar
@@ -0,0 +1 @@
1
+ name = Minim Audio
File without changes
Binary file
Binary file
Binary file
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ name = Network
Binary file
@@ -1,13 +1,10 @@
1
1
  # If you want to support more platforms, see the jogl.dev.java.net to get the
2
- # natives libraries for the platform in question (i.e. solaris). Then, add it
3
- # them to the applet line for export. For applications, you'll have to make the
4
- # changes by hand, i.e. use the linux version of the export, and modify its
5
- # contents to include the necessary files for your platform.
2
+ # natives libraries for the platform in question (i.e. Solaris).
6
3
 
7
- application.macosx = opengl.jar, jogl.jar, libjogl.jnilib, libjogl_awt.jnilib, libjogl_cg.jnilib, gluegen-rt.jar, libgluegen-rt.jnilib
4
+ name = OpenGL
8
5
 
9
- application.windows = opengl.jar, jogl.jar, jogl.dll, jogl_awt.dll, jogl_cg.dll, gluegen-rt.jar, gluegen-rt.dll
10
-
11
- application.linux = opengl.jar, jogl.jar, gluegen-rt.jar, libjogl.so, libjogl_awt.so, libjogl_cg.so, libgluegen-rt.so
12
-
13
- applet = opengl.jar, jogl.jar, jogl.jar.pack.gz, jogl-natives-linux-i586.jar, jogl-natives-linux-amd64.jar, jogl-natives-macosx-ppc.jar, jogl-natives-macosx-universal.jar, jogl-natives-windows-i586.jar, jogl-natives-windows-amd64.jar, gluegen-rt.jar, gluegen-rt.jar.pack.gz, gluegen-rt-natives-linux-amd64.jar, gluegen-rt-natives-windows-amd64.jar, gluegen-rt-natives-linux-i586.jar, gluegen-rt-natives-windows-i586.jar, gluegen-rt-natives-macosx-ppc.jar, gluegen-rt-natives-macosx-universal.jar
6
+ # In releases later than (but not including) 1.0.9, the applet JAR files
7
+ # are downloaded directly from Sun, so that a single version is cached
8
+ # on the user's computer, rather than increasing the download size with
9
+ # the versions for each platform.
10
+ applet = opengl.jar
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ name = PDF Export
Binary file
Binary file
Binary file
@@ -1,3 +1 @@
1
- application.macosx = serial.jar, RXTXcomm.jar, librxtxSerial.jnilib
2
- application.windows = serial.jar, RXTXcomm.jar, rxtxSerial.dll
3
- application.linux = serial.jar, RXTXcomm.jar, librxtxSerial.so
1
+ name = Serial I/O
Binary file
@@ -0,0 +1 @@
1
+ name = Video
Binary file
File without changes
@@ -0,0 +1,182 @@
1
+ # Drawolver: draw 2D & revolve 3D
2
+
3
+ # Example to show how to extend Ruby classes in a usefull way and how to
4
+ # use PVector.
5
+
6
+ # 2010-03-22 - fjenett
7
+
8
+ class Drawvolver < Processing::App
9
+
10
+ load_library :opengl
11
+
12
+ def setup
13
+
14
+ size 640, 360, (library_loaded?(:opengl) ? OPENGL : P3D)
15
+ frame_rate 30
16
+
17
+ reset_scene
18
+ end
19
+
20
+ def draw
21
+
22
+ background 255
23
+
24
+ if ( !@drawing_mode )
25
+
26
+ translate width/2, height/2
27
+ rotate_x @rot_x
28
+ rotate_y @rot_y
29
+ @rot_x += 0.01
30
+ @rot_y += 0.02
31
+ translate( -width/2, -height/2 )
32
+ end
33
+
34
+ no_fill
35
+ stroke 0
36
+
37
+ @points.each_pair { |ps, pe|
38
+
39
+ line ps.x, ps.y, pe.x, pe.y
40
+ }
41
+
42
+ if ( !@drawing_mode )
43
+
44
+ no_stroke
45
+ fill 120
46
+ lights
47
+
48
+ @vertices.each_pair { |r1, r2|
49
+
50
+ begin_shape TRIANGLE_STRIP
51
+
52
+ [r1,r2].one_of_each { |v1, v2|
53
+
54
+ vertex v1.x, v1.y, v1.z
55
+ vertex v2.x, v2.y, v2.z
56
+ }
57
+ end_shape
58
+ }
59
+ end
60
+
61
+ end
62
+
63
+ def reset_scene
64
+
65
+ @drawing_mode = true
66
+ @points = []
67
+ @rot_x = 0.0
68
+ @rot_y = 0.0
69
+ end
70
+
71
+ def mouse_pressed
72
+ reset_scene
73
+ @points.push RPVector.new( mouse_x, mouse_y )
74
+ end
75
+
76
+ def mouse_dragged
77
+ @points.push RPVector.new( mouse_x, mouse_y )
78
+ end
79
+
80
+ def mouse_released
81
+ @points.push RPVector.new( mouse_x, mouse_y )
82
+ recalculate_shape
83
+ end
84
+
85
+ def recalculate_shape
86
+
87
+ @vertices = []
88
+ @points.each_pair { |ps, pe|
89
+
90
+ b = @points.last - @points.first
91
+ len = b.mag
92
+ b.normalize
93
+
94
+ a = ps - @points.first
95
+
96
+ dot = a.dot b
97
+
98
+ b = b * dot
99
+
100
+ normal = @points.first + b
101
+
102
+ c = ps - normal
103
+ nlen = c.mag
104
+
105
+ @vertices.push []
106
+
107
+ (0..360).step( 12 ) { |deg|
108
+
109
+ ang = radians deg
110
+ e = normal + c * cos( ang )
111
+ e.z = c.mag * sin( ang )
112
+
113
+ @vertices.last.push e
114
+ }
115
+ }
116
+ @drawing_mode = false
117
+ end
118
+
119
+ end
120
+
121
+
122
+ # this is a custom extension of the default Array class allowing for
123
+ # more readable code above.
124
+ #
125
+ class Array
126
+
127
+ # send pairs into a block:
128
+ # array [1,2,3,4] sends
129
+ # [1,2] , [2,3] , [3,4]
130
+ def each_pair ( &block )
131
+ i = 1
132
+ while i < self.length do
133
+ yield( self[i-1], self[i] );
134
+ i = i + 1
135
+ end
136
+ end
137
+
138
+ # send one item from each array, expects array to be 2D:
139
+ # array [[1,2,3], [a,b,c]] sends
140
+ # [1,a] , [2,b] , [3,c]
141
+ def one_of_each ( &block )
142
+
143
+ i = 0
144
+ one = self[0]
145
+ two = self[1]
146
+ mi = one.length > two.length ? two.length : one.length
147
+ while i < mi do
148
+ yield( one[i], two[i] )
149
+ i = i + 1
150
+ end
151
+ end
152
+
153
+ end
154
+
155
+
156
+ # a wrapper around PVector that implements operators methods for +, -, *, /
157
+ #
158
+ class RPVector < Java::ProcessingCore::PVector
159
+
160
+ def + ( other )
161
+ v = RPVector.add( self, other )
162
+ RPVector.new v.x, v.y, v.z
163
+ end
164
+
165
+ def - ( other )
166
+ v = RPVector.sub( self, other )
167
+ RPVector.new v.x, v.y, v.z
168
+ end
169
+
170
+ def * ( other )
171
+ v = RPVector.mult( self, other )
172
+ RPVector.new v.x, v.y, v.z
173
+ end
174
+
175
+ def / ( other )
176
+ v = RPVector.div( self, other )
177
+ RPVector.new v.x, v.y, v.z
178
+ end
179
+
180
+ end
181
+
182
+ Drawvolver.new :title => "Drawvolver - fjenett 2010-03"
@@ -2,7 +2,7 @@
2
2
  # original by Kyle McDonald
3
3
  # http://www.openprocessing.org/visuals/?visualID=1182
4
4
 
5
- # This sketch takes advantage of multiple processors by running calculations
5
+ # This sketch takes advantage of multiple processors by running calculations
6
6
  # in a separate thread.
7
7
 
8
8
  CELL_COUNT = 5000
@@ -11,7 +11,7 @@ ROTATION = 0.004
11
11
  LINE_LENGTH = 37
12
12
  MULTI_THREADED = true
13
13
 
14
- def setup
14
+ def setup
15
15
  size(500, 500, P3D)
16
16
  stroke(0, 0, 0, 25)
17
17
  initialize_cells
@@ -46,28 +46,28 @@ def mouse_pressed
46
46
  end
47
47
 
48
48
  class Cell
49
-
49
+
50
50
  def initialize(x, y)
51
51
  @x, @y = x, y
52
52
  @spin = 0
53
53
  @angle = 0
54
54
  end
55
-
55
+
56
56
  def reset
57
57
  @spin, @angle = 0, 0
58
58
  end
59
-
59
+
60
60
  def update
61
61
  det = ((pmouse_x-@x) * (mouse_y-@y) - (mouse_x-@x) * (pmouse_y-@y)).to_f
62
62
  @spin += ROTATION * det / dist(@x, @y, mouse_x, mouse_y).to_f
63
63
  @spin *= SLOW_DOWN
64
64
  @angle += @spin
65
65
  end
66
-
66
+
67
67
  def sense
68
68
  update unless MULTI_THREADED
69
69
  d = LINE_LENGTH * @spin + 0.001
70
70
  line(@x, @y, @x + d * Math.cos(@angle), @y + d * Math.sin(@angle))
71
71
  end
72
-
72
+
73
73
  end