voxel_chunk#
- k3d.factory.voxel_chunk(voxels: List | ndarray | Tuple, coord: List | ndarray | Tuple, multiple: int = 1, compression_level: int = 0) VoxelChunk[source]#
Create a VoxelChunk object for selective updating voxels.
- Parameters:
voxels (array_like) – Array of voxel data.
coord (array_like) – Coordinates for the chunk.
multiple (int, optional) – Multiple factor, by default 1.
compression_level (int, optional) – Compression level for the chunk, by default 0.
- Returns:
VoxelChunk object.
- Return type:
VoxelChunk
See also
Examples#
import k3d
import numpy as np
voxels = np.array([[[0, 1],
[1, 2]],
[[2, 2],
[1, 1]]])
chunk = k3d.voxel_chunk(voxels, [0, 0, 0])
"""
VoxelChunk(coord=array([0, 0, 0], dtype=uint32),
id=139644634801104,
multiple=1,
voxels=array([[[0, 1],
[1, 2]],
[[2, 2],
[1, 1]]], dtype=uint8))
"""