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():
    py5.size(100, 100, py5.P3D)
    py5.no_fill()
    py5.translate(50, 50, 0)
    py5.rotate_y(py5.PI/6)
    global matrix
    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 Java method: getMatrix

Syntax

get_matrix() -> NDArray[(Any, Any), Float]
get_matrix(target: NDArray[(2, 3), Float], /) -> NDArray[(2, 3), Float]
get_matrix(target: NDArray[(4, 4), Float], /) -> NDArray[(4, 4), Float]

Parameters

  • target: NDArray[(2, 3), Float] - transformation matrix data

  • target: NDArray[(4, 4), Float] - transformation matrix data

Updated on September 11, 2021 16:51:34pm UTC