File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,15 @@ def key_pressed
88
88
@corner = @mesh . before ( @corner )
89
89
when 'o'
90
90
@corner = @mesh . opposite ( @corner )
91
+ when 'q' , 'Q'
92
+ Processing . app . exit
93
+ end
91
94
end
92
- end
93
95
94
96
def mouse_pressed
95
97
mouse_point = Point . new ( mouse_x , mouse_y )
96
98
@point = polygon . closest_point ( mouse_point , 4 )
97
- if key_pressed? and key == ?d and @point . nil?
99
+ if key_pressed? and key == 'd' and @point . nil?
98
100
closest = polygon . closest ( mouse_point )
99
101
index = polygon . vertices . index ( closest )
100
102
polygon . vertices . insert ( index + 1 , mouse_point )
@@ -132,7 +134,7 @@ def actions
132
134
def show_help
133
135
@line = 1
134
136
fill ( color ( 0 , 0 , 128 ) )
135
- scribe ( 'Project 5 (Bulge) by Brandon Whitehead ' )
137
+ scribe ( 'Press q or Q to quit ' )
136
138
scribe ( '' )
137
139
scribe ( 'To insert a point hold d and click in/on the polygon' )
138
140
scribe ( 'To modify vertex count press < or >' )
@@ -296,6 +298,7 @@ def draw_mesh
296
298
maxn = normals . max * 1.2
297
299
end
298
300
@mesh . triangles . each do |triangle |
301
+ java_signature 'int color(float, float, float)'
299
302
fill ( color ( 0 , 25 , 255 - 255 * triangle . normal . abs / maxn ) ) if @color
300
303
begin_shape ( POLYGON )
301
304
triangle . each do |point |
Original file line number Diff line number Diff line change 1
1
# draw module
2
2
module Draw
3
- include Processing :: Proxy
3
+ include_package 'processing.core'
4
4
def draw_point ( point , thick = 2 )
5
5
ellipse ( point . x , point . y , thick , thick )
6
6
end
@@ -25,7 +25,7 @@ def draw_polygon(polygon, hash = {})
25
25
polygon . each do |point |
26
26
vertex ( point . x , point . y )
27
27
end
28
- hash . key? ( :close ) ? end_shape ( hash [ close ] ) : end_shape ( CLOSE )
28
+ hash . key? ( :close ) ? end_shape ( hash [ close ] ) : end_shape ( PConstants :: CLOSE )
29
29
end
30
30
31
31
def draw_smooth_polygon ( polygon , refine = 5 , hash = { } )
You can’t perform that action at this time.
0 commit comments