apply_matrix()#

Multiplies the current matrix by the one specified through the parameters.

Examples#

example picture for apply_matrix()
 1def setup():
 2    py5.size(100, 100, py5.P3D)
 3    py5.no_fill()
 4    py5.translate(50, 50, 0)
 5    py5.rotate_y(py5.PI/6)
 6    py5.stroke(153)
 7    py5.box(35)
 8    # set rotation angles
 9    ct = py5.cos(py5.PI/9.0)
10    st = py5.sin(py5.PI/9.0)
11    # matrix for rotation around the Y axis
12    py5.apply_matrix(ct, 0.0, st, 0.0,
13                     0.0, 1.0, 0.0, 0.0,
14                     -st, 0.0, ct, 0.0,
15                     0.0, 0.0, 0.0, 1.0)
16    py5.stroke(255)
17    py5.box(50)

Description#

Multiplies the current matrix by the one specified through the parameters. This is very slow because it will try to calculate the inverse of the transform, so avoid it whenever possible. The equivalent function in OpenGL is gl_mult_matrix().

Underlying Processing method: applyMatrix

Syntax#

apply_matrix(n00: float, n01: float, n02: float, n03: float, n10: float, n11: float, n12: float, n13: float, n20: float, n21: float, n22: float, n23: float, n30: float, n31: float, n32: float, n33: float, /) -> None
apply_matrix(n00: float, n01: float, n02: float, n10: float, n11: float, n12: float, /) -> None
apply_matrix(source: npt.NDArray[np.floating], /) -> None

Parameters#

  • n00: float - numbers which define the 4x4 matrix to be multiplied

  • n01: float - numbers which define the 4x4 matrix to be multiplied

  • n02: float - numbers which define the 4x4 matrix to be multiplied

  • n03: float - numbers which define the 4x4 matrix to be multiplied

  • n10: float - numbers which define the 4x4 matrix to be multiplied

  • n11: float - numbers which define the 4x4 matrix to be multiplied

  • n12: float - numbers which define the 4x4 matrix to be multiplied

  • n13: float - numbers which define the 4x4 matrix to be multiplied

  • n20: float - numbers which define the 4x4 matrix to be multiplied

  • n21: float - numbers which define the 4x4 matrix to be multiplied

  • n22: float - numbers which define the 4x4 matrix to be multiplied

  • n23: float - numbers which define the 4x4 matrix to be multiplied

  • n30: float - numbers which define the 4x4 matrix to be multiplied

  • n31: float - numbers which define the 4x4 matrix to be multiplied

  • n32: float - numbers which define the 4x4 matrix to be multiplied

  • n33: float - numbers which define the 4x4 matrix to be multiplied

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

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