ruby-processing 1.0.9 → 1.0.10.1
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.
- data/CHANGELOG +13 -1
- data/bin/rp5 +8 -2
- data/lib/core/core.jar +0 -0
- data/lib/core/jruby-complete.jar +0 -0
- data/lib/ruby-processing.rb +2 -2
- data/lib/ruby-processing/app.rb +108 -338
- data/lib/ruby-processing/config.rb +6 -0
- data/lib/ruby-processing/helper_methods.rb +120 -0
- data/lib/ruby-processing/library_loader.rb +140 -0
- data/lib/ruby-processing/runner.rb +34 -4
- data/lib/ruby-processing/runners/base.rb +10 -11
- data/lib/ruby-processing/runners/live.rb +1 -1
- data/lib/ruby-processing/runners/run.rb +1 -1
- data/lib/ruby-processing/runners/watch.rb +18 -76
- data/lib/templates/applet/index.html.erb +8 -9
- data/library/control_panel/control_panel.rb +1 -1
- data/library/dxf/library/dxf.jar +0 -0
- data/library/dxf/library/export.txt +1 -0
- data/library/javascript/library/export.txt +3 -1
- data/library/minim/library/export.txt +1 -0
- data/library/minim/library/jl1.0.jar +0 -0
- data/library/minim/library/jsminim.jar +0 -0
- data/library/minim/library/minim-spi.jar +0 -0
- data/library/minim/library/minim.jar +0 -0
- data/library/minim/library/mp3spi1.9.4.jar +0 -0
- data/library/minim/library/tritonus_aos.jar +0 -0
- data/library/minim/library/tritonus_share.jar +0 -0
- data/library/net/library/export.txt +1 -0
- data/library/net/library/net.jar +0 -0
- data/library/opengl/library/export.txt +7 -10
- data/library/opengl/library/gluegen-rt.jar +0 -0
- data/library/opengl/library/jogl.jar +0 -0
- data/library/opengl/library/{libgluegen-rt.so → linux32/libgluegen-rt.so} +0 -0
- data/library/opengl/library/{libjogl.so → linux32/libjogl.so} +0 -0
- data/library/opengl/library/{libjogl_awt.so → linux32/libjogl_awt.so} +0 -0
- data/library/opengl/library/{libjogl_cg.so → linux32/libjogl_cg.so} +0 -0
- data/library/opengl/library/linux64/libgluegen-rt.so +0 -0
- data/library/opengl/library/linux64/libjogl.so +0 -0
- data/library/opengl/library/linux64/libjogl_awt.so +0 -0
- data/library/opengl/library/linux64/libjogl_cg.so +0 -0
- data/library/opengl/library/{libgluegen-rt.jnilib → macosx/libgluegen-rt.jnilib} +0 -0
- data/library/opengl/library/{libjogl.jnilib → macosx/libjogl.jnilib} +0 -0
- data/library/opengl/library/{libjogl_awt.jnilib → macosx/libjogl_awt.jnilib} +0 -0
- data/library/opengl/library/{libjogl_cg.jnilib → macosx/libjogl_cg.jnilib} +0 -0
- data/library/opengl/library/opengl.jar +0 -0
- data/library/opengl/library/{gluegen-rt.dll → windows32/gluegen-rt.dll} +0 -0
- data/library/opengl/library/{jogl.dll → windows32/jogl.dll} +0 -0
- data/library/opengl/library/{jogl_awt.dll → windows32/jogl_awt.dll} +0 -0
- data/library/opengl/library/{jogl_cg.dll → windows32/jogl_cg.dll} +0 -0
- data/library/opengl/library/windows64/gluegen-rt.dll +0 -0
- data/library/opengl/library/windows64/jogl.dll +0 -0
- data/library/opengl/library/windows64/jogl_awt.dll +0 -0
- data/library/opengl/library/windows64/jogl_cg.dll +0 -0
- data/library/pdf/library/export.txt +1 -0
- data/library/pdf/library/itext.jar +0 -0
- data/library/pdf/library/pdf.jar +0 -0
- data/library/serial/library/RXTXcomm.jar +0 -0
- data/library/serial/library/export.txt +1 -3
- data/library/serial/library/linux32/librxtxSerial.so +0 -0
- data/library/serial/library/linux64/librxtxSerial.so +0 -0
- data/library/serial/library/macosx/librxtxSerial.jnilib +0 -0
- data/library/serial/library/serial.jar +0 -0
- data/library/serial/library/windows32/rxtxSerial.dll +0 -0
- data/library/serial/library/windows64/rxtxSerial.dll +0 -0
- data/library/video/library/export.txt +1 -0
- data/library/video/library/video.jar +0 -0
- data/samples/{animator.rb → contributed/animator.rb} +0 -0
- data/samples/{bezier_playground.rb → contributed/bezier_playground.rb} +0 -0
- data/samples/{circle_collision.rb → contributed/circle_collision.rb} +0 -0
- data/samples/contributed/drawolver.rb +182 -0
- data/samples/{empathy.rb → contributed/empathy.rb} +7 -7
- data/samples/{fern.rb → contributed/fern.rb} +0 -0
- data/samples/{flight_patterns.rb → contributed/flight_patterns.rb} +0 -0
- data/samples/{full_screen.rb → contributed/full_screen.rb} +0 -0
- data/samples/{getting_started.rb → contributed/getting_started.rb} +0 -0
- data/samples/{gravity.rb → contributed/gravity.rb} +0 -0
- data/samples/{jwishy.rb → contributed/jwishy.rb} +0 -0
- data/samples/{orbit.rb → contributed/orbit.rb} +0 -0
- data/samples/{pong.rb → contributed/pong.rb} +0 -0
- data/samples/{reflection.rb → contributed/reflection.rb} +0 -0
- data/samples/{simple_buffer.rb → contributed/simple_buffer.rb} +0 -0
- data/samples/{tree.rb → contributed/tree.rb} +0 -0
- data/samples/peasy_cam/library/hilbert/hilbert.rb +11 -10
- data/samples/processing_app/3D/camera/move_eye.rb +29 -0
- data/samples/processing_app/3D/form/brick_tower.rb +11 -11
- data/samples/processing_app/3D/form/cubic_grid.rb +51 -0
- data/samples/processing_app/3D/form/icosahedra/icosahedra.rb +76 -0
- data/samples/processing_app/3D/form/icosahedra/icosahedron.rb +116 -0
- data/samples/processing_app/3D/form/icosahedra/shape_3D.rb +25 -0
- data/samples/processing_app/3D/form/primitives.rb +42 -0
- data/samples/processing_app/3D/form/rgb_cube.rb +88 -0
- data/samples/processing_app/3D/form/shape_transform.rb +94 -0
- data/samples/processing_app/3D/form/toroid.rb +130 -0
- data/samples/processing_app/3D/form/vertices.rb +81 -0
- data/samples/processing_app/3D/image/data/eames.jpg +0 -0
- data/samples/processing_app/3D/image/data/ystone08.jpg +0 -0
- data/samples/processing_app/3D/image/explode.rb +56 -0
- data/samples/processing_app/3D/image/extrusion.rb +49 -0
- data/samples/processing_app/3D/image/zoom.rb +83 -0
- data/samples/processing_app/3D/lights/directional.rb +41 -0
- data/samples/processing_app/3D/lights/lights1.rb +39 -0
- data/samples/processing_app/3D/lights/lights2.rb +42 -0
- data/samples/processing_app/3D/lights/reflection.rb +38 -0
- data/samples/processing_app/3D/lights/spot.rb +39 -0
- data/samples/processing_app/3D/textures/data/berlin-1.jpg +0 -0
- data/samples/processing_app/3D/textures/texture1.rb +41 -0
- data/samples/processing_app/3D/textures/texture2.rb +38 -0
- data/samples/processing_app/3D/textures/texture3.rb +68 -0
- data/samples/processing_app/3D/textures/texture_cube.rb +106 -0
- data/samples/processing_app/3D/transform/bird.rb +61 -0
- data/samples/processing_app/3D/transform/birds/bird.rb +87 -0
- data/samples/processing_app/3D/transform/birds/birds.rb +48 -0
- data/samples/processing_app/3D/transform/cubes_in_cube/cube.rb +57 -0
- data/samples/processing_app/3D/transform/cubes_in_cube/cubes_in_cube.rb +102 -0
- data/samples/processing_app/3D/transform/push_pop_cubes.rb +152 -0
- data/samples/processing_app/3D/transform/rotate1.rb +43 -0
- data/samples/processing_app/3D/transform/rotate2.rb +45 -0
- data/samples/processing_app/3D/typography/data/Univers45.vlw +0 -0
- data/samples/processing_app/3D/typography/letter_k.rb +136 -0
- data/samples/processing_app/3D/typography/typing.rb +77 -0
- data/samples/processing_app/basics/form/triangle_strip.rb +19 -19
- data/samples/processing_app/basics/math/distance1.rb +59 -0
- data/samples/processing_app/basics/math/distance2.rb +38 -0
- data/samples/processing_app/basics/math/double_random.rb +38 -0
- data/samples/processing_app/basics/math/graphing_2_d_equation.rb +53 -0
- data/samples/processing_app/basics/math/increment_decrement.rb +59 -0
- data/samples/processing_app/basics/math/modulo.rb +43 -0
- data/samples/processing_app/basics/math/noise_1_d.rb +37 -0
- data/samples/processing_app/basics/math/noise_2_d.rb +47 -0
- data/samples/processing_app/basics/math/noise_3_d.rb +50 -0
- data/samples/processing_app/basics/math/noise_wave.rb +61 -0
- data/samples/processing_app/basics/math/operator_precedence.rb +70 -0
- data/samples/processing_app/basics/math/polar_to_cartesian.rb +44 -0
- data/samples/processing_app/basics/math/random.rb +35 -0
- data/samples/processing_app/basics/math/sine.rb +49 -0
- data/samples/processing_app/basics/math/sine_cosine.rb +60 -0
- data/samples/processing_app/basics/math/sine_wave.rb +62 -0
- data/samples/processing_app/basics/objects/composite_objects.rb +139 -0
- data/samples/processing_app/basics/objects/inheritance.rb +104 -0
- data/samples/processing_app/basics/objects/multiple_constructors.rb +66 -0
- data/samples/processing_app/basics/objects/objects.rb +72 -0
- data/samples/processing_app/basics/shape/data/bot1.svg +160 -0
- data/samples/processing_app/basics/shape/data/usa-wikipedia.svg +452 -0
- data/samples/processing_app/basics/shape/disable_style.rb +36 -0
- data/samples/processing_app/basics/shape/get_child.rb +43 -0
- data/samples/processing_app/basics/shape/load_display_shape.rb +33 -0
- data/samples/processing_app/basics/shape/scale_shape.rb +33 -0
- data/samples/processing_app/basics/structure/coordinates.rb +55 -0
- data/samples/processing_app/basics/structure/create_graphics.rb +39 -0
- data/samples/processing_app/basics/structure/functions.rb +41 -0
- data/samples/processing_app/basics/structure/loop.rb +39 -0
- data/samples/processing_app/basics/structure/noloop.rb +33 -0
- data/samples/processing_app/basics/structure/recursion1.rb +42 -0
- data/samples/processing_app/basics/structure/recursion2.rb +39 -0
- data/samples/processing_app/basics/structure/redraw.rb +36 -0
- data/samples/processing_app/basics/structure/setup_draw.rb +30 -0
- data/samples/processing_app/basics/structure/statements_comments.rb +32 -0
- data/samples/processing_app/basics/structure/width_height.rb +29 -0
- data/samples/processing_app/basics/transform/arm.rb +47 -0
- data/samples/processing_app/basics/transform/rotate.rb +43 -0
- data/samples/processing_app/basics/transform/scale.rb +45 -0
- data/samples/processing_app/basics/transform/translate.rb +41 -0
- data/samples/processing_app/basics/transform/triangle_flower.rb +69 -0
- data/samples/processing_app/basics/typography/data/CourierNew36.vlw +0 -0
- data/samples/processing_app/basics/typography/data/Ziggurat-HTF-Black-32.vlw +0 -0
- data/samples/processing_app/basics/typography/letters.rb +52 -0
- data/samples/processing_app/basics/typography/words.rb +37 -0
- data/samples/processing_app/basics/web/embedded_links.rb +58 -0
- data/samples/processing_app/basics/web/loading_images.rb +25 -0
- metadata +181 -86
- data/lib/patches/JRubyApplet.diff +0 -24
- data/lib/patches/PATCHES.txt +0 -3
- data/lib/patches/PApplet.diff +0 -27
- data/library/minim/license.txt +0 -339
- data/library/minim/version.txt +0 -1
- data/library/opengl/library/gluegen-rt-natives-linux-amd64.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-linux-i586.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-macosx-ppc.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-macosx-universal.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-windows-amd64.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-windows-i586.jar +0 -0
- data/library/opengl/library/gluegen-rt.jar.pack.gz +0 -0
- data/library/opengl/library/jogl-natives-linux-amd64.jar +0 -0
- data/library/opengl/library/jogl-natives-linux-i586.jar +0 -0
- data/library/opengl/library/jogl-natives-macosx-ppc.jar +0 -0
- data/library/opengl/library/jogl-natives-macosx-universal.jar +0 -0
- data/library/opengl/library/jogl-natives-windows-amd64.jar +0 -0
- data/library/opengl/library/jogl-natives-windows-i586.jar +0 -0
- data/library/opengl/library/jogl.jar.pack.gz +0 -0
- data/library/pdf/notes.txt +0 -8
- data/library/serial/library/librxtxSerial.jnilib +0 -0
- data/library/serial/library/librxtxSerial.so +0 -0
- 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>
|
data/library/dxf/library/dxf.jar
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
name = DXF Export
|
|
@@ -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
|
data/library/net/library/net.jar
CHANGED
|
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.
|
|
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
|
-
|
|
4
|
+
name = OpenGL
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
applet = opengl.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
name = PDF Export
|
|
Binary file
|
data/library/pdf/library/pdf.jar
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
name = Video
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
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
|