get_matrix()

Get the current matrix as a numpy array.

Examples

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