get_matrix()#

Get the current matrix as a numpy array.

Examples#

example picture for get_matrix()
 1def setup():
 2    global matrix
 3    py5.size(100, 100, py5.P3D)
 4    py5.no_fill()
 5    py5.translate(50, 50, 0)
 6    py5.rotate_y(py5.PI/6)
 7    matrix = py5.get_matrix()
 8    py5.println(matrix)
 9    py5.println(matrix.dtype)
10    py5.stroke(153)
11    py5.box(50)

Description#

Get the current matrix as a numpy array. Use the target parameter to put the matrix data in a properly sized and typed numpy array.

Underlying Processing method: getMatrix

Syntax#

get_matrix() -> npt.NDArray[np.floating]
get_matrix(target: npt.NDArray[np.floating], /) -> npt.NDArray[np.floating]

Parameters#

  • target: npt.NDArray[np.floating] - transformation matrix with a shape of 2x3 for 2D transforms or 4x4 for 3D transforms

Updated on March 22, 2022 21:53:01pm UTC