bounding_corners#
- k3d.helpers.bounding_corners(bounds, z_bounds=(0, 1))[source]#
Return corner point coordinates for bounds array.
z_bounds assigns Z points coordinates if bounds contains less than 5 items.
- Parameters
bounds (array_like) – Array of numbers.
z_bounds (tuple, optional) – Two numbers, by default (0, 1).
- Returns
Corner points coordinates.
- Return type
ndarray
Examples#
Z-bounds#
import k3d
import numpy as np
bounds = np.array([1, 2, 3, 4])
corners_coordinates = k3d.helpers.bounding_corners(bounds, z_bounds=(-1, 1))
"""
array([[ 1, 3, -1],
[ 1, 3, 1],
[ 1, 4, -1],
[ 1, 4, 1],
[ 2, 3, -1],
[ 2, 3, 1],
[ 2, 4, -1],
[ 2, 4, 1]])
"""
No z-bounds#
import k3d
import numpy as np
bounds = np.array([1, 2, 3, 4, 5])
corners_coordinates = k3d.helpers.bounding_corners(bounds)
"""
array([[1, 3, 5],
[1, 4, 5],
[2, 3, 5],
[2, 4, 5]])
"""