Set many vertex points at the same time, using a numpy array.
1import numpy as np 2 3def setup(): 4 vertices = 100 * np.random.rand(25, 2) 5 s = py5.create_shape() 6 s.begin_shape() 7 s.no_fill() 8 s.set_path(vertices.shape, vertices) 9 s.end_shape() 10 py5.shape(s)
Set many vertex points at the same time, using a numpy array. This will be faster and more efficient than repeatedly calling Py5Shape.set_vertex() in a loop. Setting the vertex codes is not supported, so the vertices will be regular vertices and not bezier, quadratic or curve vertices.
vcount parameter cannot be larger than the first dimension of the
Underlying Processing method: PShape.setPath
set_path(vcount: int, verts: npt.NDArray[np.floating], /) -> None
vcount: int - number of vertices
verts: npt.NDArray[np.floating] - 2D array of vertex coordinates
Updated on February 26, 2022 13:22:44pm UTC