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.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/CHANGELOG +5 -0
- data/README.md +4 -2
- data/lib/ruby-processing/exporters/application_exporter.rb +1 -0
- data/lib/ruby-processing/version.rb +1 -1
- data/library/boids/boids.rb +14 -13
- data/library/vecmath/lib/vec.rb +20 -4
- data/samples/contributed/circle_collision.rb +92 -149
- data/samples/contributed/drawolver.rb +13 -27
- data/samples/contributed/elegant_ball.rb +158 -0
- data/samples/contributed/fern.rb +16 -3
- data/samples/contributed/flight_patterns.rb +16 -4
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/bumpy_surface_noise.rb +4 -9
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/data/java_args.txt +0 -0
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/library/custom_shape/custom_shape.rb +1 -1
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/library/particle_system/particle_system.rb +7 -10
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/library/surface/surface.rb +2 -2
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/liquidy.rb +7 -7
- data/samples/external_library/java_processing/{pbox2d → box2d_processing}/polygons.rb +4 -9
- data/samples/external_library/java_processing/custom/README.md +15 -0
- data/samples/external_library/java_processing/custom/Rakefile +28 -0
- data/samples/external_library/java_processing/custom/landscape.rb +58 -0
- data/samples/external_library/java_processing/custom/src/nn/Connection.java +47 -0
- data/samples/external_library/java_processing/custom/src/nn/HiddenNeuron.java +20 -0
- data/samples/external_library/java_processing/custom/src/nn/InputNeuron.java +23 -0
- data/samples/external_library/java_processing/custom/src/nn/Network.java +136 -0
- data/samples/external_library/java_processing/custom/src/nn/Neuron.java +79 -0
- data/samples/external_library/java_processing/custom/src/nn/OutputNeuron.java +7 -0
- data/samples/external_library/java_processing/custom/xor.rb +88 -0
- data/samples/external_library/ruby_gem/README +1 -1
- data/samples/external_library/ruby_gem/data/data.json +8 -0
- data/samples/external_library/ruby_gem/draw_test.rb +171 -0
- data/samples/processing_app/basics/form/icosahedra.rb +39 -0
- data/samples/processing_app/basics/form/library/icosahedron/icosahedron.rb +60 -0
- data/samples/processing_app/basics/form/toroid.rb +78 -92
- data/samples/processing_app/basics/transform/birds.rb +6 -12
- data/samples/processing_app/basics/transform/cubes_in_cube.rb +25 -22
- data/samples/processing_app/basics/transform/library/cube/cube.rb +16 -16
- data/samples/processing_app/basics/transform/rotate_push_pop.rb +1 -1
- data/samples/processing_app/demos/graphics/bezier_patch.rb +18 -31
- data/samples/processing_app/demos/graphics/trefoil.rb +15 -15
- data/samples/processing_app/library/vecmath/acceleration_with_vectors.rb +3 -3
- data/samples/processing_app/library/vecmath/hilbert_fractal.rb +2 -2
- data/samples/processing_app/library/vecmath/library/flock/flock.rb +18 -21
- data/samples/processing_app/library/vecmath/library/hilbert/hilbert.rb +11 -8
- data/samples/processing_app/library/vecmath/library/wiggler/wiggler.rb +7 -15
- data/samples/processing_app/library/vecmath/seeking_neural.rb +172 -0
- data/samples/processing_app/topics/animation/animated_sprite.rb +5 -8
- data/samples/processing_app/topics/animation/sequential.rb +2 -3
- data/samples/processing_app/topics/create_shapes/library/particle/particle_system.rb +7 -7
- data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +2 -2
- data/samples/processing_app/topics/create_shapes/wiggle_pshape.rb +2 -1
- data/samples/processing_app/topics/lsystems/koch.rb +1 -1
- data/samples/processing_app/topics/lsystems/library/koch/koch_fractal.rb +24 -23
- data/samples/processing_app/topics/motion/circle_collision.rb +117 -160
- data/samples/processing_app/topics/motion/library/cube/cube.rb +1 -1
- data/samples/processing_app/topics/motion/morph.rb +1 -1
- data/samples/processing_app/topics/motion/reflection1.rb +17 -16
- data/samples/processing_app/topics/shaders/conway.rb +2 -2
- data/samples/processing_app/topics/shaders/data/conway.glsl +10 -10
- data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +9 -8
- data/samples/processing_app/topics/shaders/landscape.rb +1 -1
- data/samples/processing_app/topics/simulate/flocking.rb +1 -1
- data/samples/processing_app/topics/simulate/library/flock/flock.rb +62 -57
- data/samples/processing_app/topics/simulate/multiple_particle_systems.rb +8 -28
- data/samples/processing_app/topics/simulate/simple_particle_system.rb +9 -7
- data/samples/processing_app/topics/simulate/smoke_particle_system.rb +12 -11
- data/vendors/Rakefile +2 -2
- metadata +26 -21
- data/samples/contributed/pong.rb +0 -177
- data/samples/contributed/simple_buffer.rb +0 -44
- data/samples/external_library/java_processing/pbox2d/contact_test.rb +0 -23
- data/samples/processing_app/basics/form/icosahedra/icosahedra.rb +0 -72
- data/samples/processing_app/basics/form/icosahedra/icosahedron.rb +0 -116
- data/samples/processing_app/basics/form/icosahedra/shape_3D.rb +0 -25
@@ -1,116 +0,0 @@
|
|
1
|
-
|
2
|
-
# fjenett, 2010-03-11:
|
3
|
-
# Mixing in Processing::Proxy makes classes behave like inner classes(*) of
|
4
|
-
# a Processing sketch (any class that's defined in a sketch and that is
|
5
|
-
# inside a .pde file). This is needed for a class to be able to call any
|
6
|
-
# drawing commands etc.
|
7
|
-
# (*) Ruby does not know inner classes btw. ...
|
8
|
-
|
9
|
-
|
10
|
-
require './shape_3D' # load shape_3D.rb
|
11
|
-
|
12
|
-
class Icosahedron < Shape3D # extends Shape3D
|
13
|
-
|
14
|
-
include Processing::Proxy # mixin Processing::Proxy
|
15
|
-
|
16
|
-
attr_accessor :top_point, :top_pent
|
17
|
-
attr_accessor :bottom_point, :bottom_pent
|
18
|
-
attr_accessor :angle, :radius
|
19
|
-
attr_accessor :tri_dist, :tri_ht
|
20
|
-
attr_accessor :a, :b, :c
|
21
|
-
|
22
|
-
def initialize ( *args )
|
23
|
-
|
24
|
-
super args # call Shape3D.new( args )
|
25
|
-
|
26
|
-
@radius = args.first
|
27
|
-
@top_pent = Array.new 5
|
28
|
-
@bottom_pent = Array.new 5
|
29
|
-
@angle = 0.0
|
30
|
-
|
31
|
-
init
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def init
|
36
|
-
|
37
|
-
@c = dist( cos(0) * @radius,
|
38
|
-
sin(0) * @radius,
|
39
|
-
cos(radians( 72 )) * @radius,
|
40
|
-
sin(radians( 72 )) * @radius )
|
41
|
-
|
42
|
-
@b = @radius
|
43
|
-
|
44
|
-
@a = sqrt(@c*@c - @b*@b)
|
45
|
-
|
46
|
-
@tri_ht = sqrt( @c*@c - (@c/2) * (@c/2) )
|
47
|
-
|
48
|
-
@top_pent.each_with_index { |v, i|
|
49
|
-
|
50
|
-
@top_pent[i] = PVector.new( cos(@angle) * @radius,
|
51
|
-
sin(@angle) * @radius,
|
52
|
-
@tri_ht / 2 )
|
53
|
-
|
54
|
-
@angle += radians 72
|
55
|
-
}
|
56
|
-
|
57
|
-
@top_point = PVector.new 0, 0, @tri_ht / 2 + @a
|
58
|
-
|
59
|
-
@angle = 72.0/2
|
60
|
-
|
61
|
-
@bottom_pent.each_with_index { |v, i|
|
62
|
-
|
63
|
-
@bottom_pent[i] = PVector.new( cos(@angle) * @radius,
|
64
|
-
sin(@angle) * @radius,
|
65
|
-
-@tri_ht / 2 )
|
66
|
-
@angle += radians 72
|
67
|
-
}
|
68
|
-
|
69
|
-
@bottom_point = PVector.new 0, 0, -(@tri_ht / 2 + @a)
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
def draw
|
74
|
-
|
75
|
-
[@top_pent, @bottom_pent].each { |pent| # top and bottom pentagram
|
76
|
-
|
77
|
-
(0...pent.length).each { |i|
|
78
|
-
|
79
|
-
begin_shape
|
80
|
-
|
81
|
-
# next or first
|
82
|
-
n = i+1
|
83
|
-
n = n % @top_pent.length # wrap around
|
84
|
-
|
85
|
-
# choose point depending on pentagram
|
86
|
-
pnt = @top_point
|
87
|
-
pnt = @bottom_point if pent == @bottom_pent
|
88
|
-
|
89
|
-
# draw triangle
|
90
|
-
vertex @x + pent[i].x, @y + pent[i].y, @z + pent[i].z
|
91
|
-
vertex @x + pnt.x, @y + pnt.y, @z + pnt.z
|
92
|
-
vertex @x + pent[n].x, @y + pent[n].y, @z + pent[n].z
|
93
|
-
|
94
|
-
end_shape CLOSE
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
begin_shape TRIANGLE_STRIP
|
99
|
-
|
100
|
-
0.upto(6) { |i| # stitch pentagrams together with triangles
|
101
|
-
|
102
|
-
j = i
|
103
|
-
j = j % @top_pent.length
|
104
|
-
|
105
|
-
n = i+2
|
106
|
-
n = n % @bottom_pent.length
|
107
|
-
|
108
|
-
vertex @x + @top_pent[j].x, @y + @top_pent[j].y, @z + @top_pent[j].z
|
109
|
-
vertex @x + @bottom_pent[n].x, @y + @bottom_pent[n].y, @z + @bottom_pent[n].z
|
110
|
-
}
|
111
|
-
|
112
|
-
end_shape
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
# fjenett, 2010-03-11:
|
3
|
-
# Left this in although it's not needed as an example for
|
4
|
-
# how to extend classes.
|
5
|
-
|
6
|
-
class Shape3D
|
7
|
-
|
8
|
-
attr_accessor :x, :y, :z
|
9
|
-
attr_accessor :w, :h, :d
|
10
|
-
|
11
|
-
def initialize (*args)
|
12
|
-
@x, @y, @z = 0.0, 0.0, 0.0
|
13
|
-
@w, @h, @d = 0.0, 0.0, 0.0
|
14
|
-
end
|
15
|
-
|
16
|
-
def rotate_x ( theta )
|
17
|
-
end
|
18
|
-
|
19
|
-
def rotate_y ( theta )
|
20
|
-
end
|
21
|
-
|
22
|
-
def rotate_z ( theta )
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|