You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
An error was thrown when using begin_contour and end_contour. If I delete the block of code that describes the contour (i.e. leaving the code that uses begin_shape and end_shape) the program runs as expected.
To Reproduce
fromp5import*defdraw():
translate(50, 50)
stroke(255, 0, 0)
begin_shape()
# Exterior part of shape, clockwise windingvertex(-40, -40)
vertex(40, -40)
vertex(40, 40)
vertex(-40, 40)
# # Interior part of shape, counter-clockwise windingbegin_contour()
vertex(-20, -20)
vertex(-20, 20)
vertex(20, 20)
vertex(20, -20)
end_contour()
end_shape('CLOSE')
run(mode="P2D")
p5 release (version number or latest commit): commit fb9373c
Python version: Python 3.7.7
Operating system: Ubuntu 18.04 LTS
Additional context
Stderr:
WARNING: Traceback (most recent call last):
File "/home/ziyao/Github/p5/test.py", line 34, in <module>
run(mode="P2D")
File "/home/ziyao/Github/p5/p5/sketch/userspace.py", line 161, in run
app.run()
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/app/_default_app.py", line 62, in run
return default_app.run()
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/app/application.py", line 152, in run
return self._backend._vispy_run()
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/app/backends/_glfw.py", line 194, in _vispy_run
self._vispy_process_events()
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/app/backends/_glfw.py", line 183, in _vispy_process_events
timer._tick()
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/app/backends/_glfw.py", line 516, in _tick
self._vispy_timer._timeout()
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/app/timer.py", line 168, in _timeout
count=self.iter_count)
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/util/event.py", line 455, in __call__
self._invoke_callback(cb, event)
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/util/event.py", line 475, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "/home/ziyao/.local/lib/python3.7/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/home/ziyao/Github/p5/p5/sketch/base.py", line 105, in on_timer
self.draw_method()
File "/home/ziyao/Github/p5/test.py", line 32, in draw
end_shape('CLOSE')
File "/home/ziyao/Github/p5/p5/core/primitives.py", line 70, in wrapped
draw_shape(s)
File "/home/ziyao/Github/p5/p5/core/primitives.py", line 588, in draw_shape
draw_shape(child_shape)
File "/home/ziyao/Github/p5/p5/core/primitives.py", line 582, in draw_shape
p5.renderer.render(shape)
File "/home/ziyao/Github/p5/p5/sketch/renderer2d.py", line 219, in render
vertices = shape._draw_vertices
File "/home/ziyao/Github/p5/p5/core/shape.py", line 363, in _draw_vertices
self._retriangulate()
File "/home/ziyao/Github/p5/p5/core/shape.py", line 333, in _retriangulate
segments=triangulation_segments, holes=self.get_interior_point(self.contour))
File "/home/ziyao/Github/p5/p5/core/shape.py", line 313, in get_interior_point
if vertex not in shape_vertices:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> for Event
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 2
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 4
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 8
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 16
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 32
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 64
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7efe85c96d10>> repeat 128
The text was updated successfully, but these errors were encountered:
Describe the bug
An error was thrown when using
begin_contour
andend_contour
. If I delete the block of code that describes the contour (i.e. leaving the code that usesbegin_shape
andend_shape
) the program runs as expected.To Reproduce
Expected behavior
A square ring is displayed on the screen.
Example from https://p5js.org/reference/#/p5/beginContour
System information:
Additional context
Stderr:
The text was updated successfully, but these errors were encountered: