get_bounding_box#
- k3d.helpers.get_bounding_box(model_matrix, boundary=[- 0.5, 0.5, - 0.5, 0.5, - 0.5, 0.5])[source]#
Return the boundaries of a model matrix.
- Parameters
model_matrix (ndarray) – Matrix of numbers. Must have four columns.
boundary (list, optional) – Array of numbers, by default [-0.5, 0.5, -0.5, 0.5, -0.5, 0.5]. Must be of the form [min_x, max_x, min_y, max_y, min_z, max_z].
- Returns
Model matrix boundaries.
- Return type
ndarray
Examples#
Set boundary#
import k3d
import numpy as np
model_matrix = np.array([[1, 2, 3, 4]])
box = k3d.helpers.get_bounding_box(model_matrix, boundary=[-3, 3, -1, 1, 0, 5])
"""
array([-5, 20])
"""
No set boundaries#
import k3d
import numpy as np
model_matrix = np.array([[1, 2, 3, 4],
[2, 4, 6, 8]])
box = k3d.helpers.get_bounding_box(model_matrix)
"""
array([-3., 3., -6., 6.])
"""