apply_matrix()

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

Examples

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