Skip to content

Commit acf4663

Browse files
committed
tap in processing
1 parent 99ed186 commit acf4663

File tree

4 files changed

+39
-35
lines changed

4 files changed

+39
-35
lines changed

external_library/java/PixelFlow/geometry_grid.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ def display_mesh(ifs)
100100

101101
def create_gizmo(s)
102102
stroke_weight(1)
103-
shp_gizmo = create_shape
104-
shp_gizmo.tap do |shp|
103+
create_shape.tap do |shp|
105104
shp.begin_shape(LINES)
106105
shp.stroke(255, 0, 0)
107106
shp.vertex(0, 0, 0)

external_library/java/PixelFlow/sampling_halton.rb

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,24 @@ def add_shape(position, scale)
3838
shp_samples.add_child(shp_point)
3939
end
4040

41-
def display_gizmo(s)
42-
if(shp_gizmo.nil?)
43-
stroke_weight(1)
44-
@shp_gizmo = create_shape
45-
shp_gizmo.begin_shape(LINES)
46-
shp_gizmo.stroke(255,0,0)
47-
shp_gizmo.vertex(0,0,0)
48-
shp_gizmo.vertex(s,0,0)
49-
shp_gizmo.stroke(0,255,0)
50-
shp_gizmo.vertex(0,0,0)
51-
shp_gizmo.vertex(0,s,0)
52-
shp_gizmo.stroke(0,0,255)
53-
shp_gizmo.vertex(0,0,0)
54-
shp_gizmo.vertex(0,0,s)
55-
shp_gizmo.end_shape
41+
def create_gizmo(s)
42+
stroke_weight(1)
43+
create_shape.tap do |shp|
44+
shp.begin_shape(LINES)
45+
shp.stroke(255, 0, 0)
46+
shp.vertex(0, 0, 0)
47+
shp.vertex(s, 0, 0)
48+
shp.stroke(0, 255, 0)
49+
shp.vertex(0, 0, 0)
50+
shp.vertex(0, s, 0)
51+
shp.stroke(0, 0, 255)
52+
shp.vertex(0, 0, 0)
53+
shp.vertex(0, 0, s)
54+
shp.end_shape
5655
end
56+
end
57+
58+
def display_gizmo(s)
59+
@shp_gizmo = create_gizmo(s) unless shp_gizmo
5760
shape(shp_gizmo)
5861
end

external_library/java/PixelFlow/sampling_poisson3d.rb

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,26 @@ def add_shape(sample)
113113
# shp_samples_spheres.addChild(shp_sphere_normals)
114114
end
115115

116-
def display_gizmo(s)
117-
if shp_gizmo.nil?
118-
stroke_weight(1)
119-
@shp_gizmo = create_shape
120-
shp_gizmo.begin_shape(LINES)
121-
shp_gizmo.stroke(255, 0, 0)
122-
shp_gizmo.vertex(0, 0, 0)
123-
shp_gizmo.vertex(s, 0, 0)
124-
shp_gizmo.stroke(0, 255, 0)
125-
shp_gizmo.vertex(0, 0, 0)
126-
shp_gizmo.vertex(0, s, 0)
127-
shp_gizmo.stroke(0, 0, 255)
128-
shp_gizmo.vertex(0, 0, 0)
129-
shp_gizmo.vertex(0, 0, s)
130-
shp_gizmo.end_shape
116+
def create_gizmo(s)
117+
stroke_weight(1)
118+
create_shape.tap do |shp|
119+
shp.begin_shape(LINES)
120+
shp.stroke(255, 0, 0)
121+
shp.vertex(0, 0, 0)
122+
shp.vertex(s, 0, 0)
123+
shp.stroke(0, 255, 0)
124+
shp.vertex(0, 0, 0)
125+
shp.vertex(0, s, 0)
126+
shp.stroke(0, 0, 255)
127+
shp.vertex(0, 0, 0)
128+
shp.vertex(0, 0, s)
129+
shp.end_shape
131130
end
132-
shape shp_gizmo
131+
end
132+
133+
def display_gizmo(s)
134+
@shp_gizmo = create_gizmo(s) unless shp_gizmo
135+
shape(shp_gizmo)
133136
end
134137

135138
def key_released

processing_app/topics/lsystems/pentagonal.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize
1616
@axiom = 'F-F-F-F-F'
1717
@grammar = Grammar.new(axiom, 'F' => 'F+F+F-F-F-F+F+F')
1818
@draw_length = 400
19-
@theta = 0.0
19+
@theta = 0
2020
@xpos = 0.0
2121
@ypos = 0.0
2222
end
@@ -100,4 +100,3 @@ def key_pressed
100100
def settings
101101
size 800, 800, P2D
102102
end
103-

0 commit comments

Comments
 (0)