lines()#

Draw a collection of lines to the screen.

Examples#

example picture for lines()
1import numpy as np
2
3def setup():
4    random_lines = 100 * np.random.rand(50, 4)
5    py5.lines(random_lines)

Description#

Draw a collection of lines to the screen. The purpose of this method is to provide an alternative to repeatedly calling line() in a loop. For a large number of lines, the performance of lines() will be much faster.

The coordinates parameter should be a numpy array with one row for each line. The first few columns are for the first point of each line and the next few columns are for the second point of each line. There will be four or six columns for 2D or 3D points, respectively.

Underlying Processing method: lines

Syntax#

lines(coordinates: npt.NDArray[np.floating], /) -> None

Parameters#

  • coordinates: npt.NDArray[np.floating] - 2D array of line coordinates with 4 or 6 columns for 2D or 3D points, respectively

Updated on February 26, 2022 13:22:44pm UTC