process_transform_arguments#

k3d.transform.process_transform_arguments(drawable, **kwargs)[source]#

Create a Transform to apply to a drawable.

Parameters
  • drawable (object) – Drawable object.

  • **kwargs

    transformTransform

    Existing Trasnform to be (re-)used on the drawable.

    xminfloat

    Lower bound in x dimsension.

    xmaxfloat

    Upper bound in x dimsension.

    yminfloat

    Lower bound in y dimsension.

    ymaxfloat

    Upper bound in y dimsension.

    zminfloat

    Lower bound in z dimsension.

    zmaxfloat

    Upper bound in z dimsension.

    bounds: array_like

    Dimensions bounds taking precedence over seperate bound arguments, [xmin, xmax, ymin, ymax, zmin, zmax] or [xmin, xmax, ymin, ymax].

    translationarray_like

    [tx, ty, tz] translation vector.

    rotationarray_like

    [gamme, rx, ry, rz] rotation vector (radians).

    scalingarray_like

    [sx, sy, sz] scaling coefficients.

    model_matrixndarray

    Matrix of numbers. Must have four columns.

Returns

Transformed Drawable.

Return type

Drawable

Raises

ValueError – Provided transform argument is not a Transform object.

Examples#

import k3d
import numpy as np
from k3d.transform import process_transform_arguments

vertices = [[1, 1, 1], [1, -1, -1], [-1, 1, -1], [-1, -1, 1]]
indices = [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 3, 1], [3, 2, 1]]

plt_tetra = k3d.mesh(vertices, indices,
                     color=0x00a86b)
plt_tetra1 = k3d.mesh(vertices, indices,
                      color=0x4ca5ff)

process_transform_arguments(plt_tetra1,
                            translation=[1, 3, 0],
                            rotation=[1, np.pi / 2, 0, 0],
                            scaling=[0.5, 1, 1.5])

plot = k3d.plot()
plot += plt_tetra
plot += plt_tetra1
plot.display()