picogl.gpu.buffers.helper

A collection of utility functions for processing and normalizing data into array-like structures or specific container types.

This module provides functions to convert input data, such as lists or arrays, into standardized formats that are used in 3D rendering contexts, such as MeshData.

Functions

as_vec3_array(data) → numpy.ndarray

Convert data to a float32 (N, 3) NumPy array.

as_meshdata(colors, normals, positions[, indices]) → picogl.renderer.MeshData

Normalize raw strand arrays/lists into a MeshData container.

Module Contents

picogl.gpu.buffers.helper.as_vec3_array(data: Any) → numpy.ndarray[source]

Convert data to a float32 (N, 3) NumPy array.

Raises:

ValueError – If the resulting array does not have shape (N, 3). positions = np.asarray(data, dtype=np.float32).reshape(-1, 3) is the faster way of doing this [1, 2, 3, 4, 5, 6] becomes [[1, 2, 3], [4, 5, 6]]

picogl.gpu.buffers.helper.as_meshdata(colors: Any, normals: Any, positions: Any, indices: Any = None) → picogl.renderer.MeshData[source]

Normalize raw strand arrays/lists into a MeshData container.