convert_to_meshes#
- MAX_ARRAY_LEVEL = 7#
Maximum array level for conversion to meshes.
- class MeshType(value)[source]#
Mesh face types.
- DEFAULT = False#
Mesh with default faces.
- INVERTED = True#
Mesh with inverted faces.
- convert_to_meshes(series_key: str, locations_tar: tarfile.TarFile, frame_spec: tuple[int, int, int], regions: list[str], box: tuple[int, int, int], mesh_type: MeshType | dict[str, MeshType] = MeshType.DEFAULT, group_size: int | None = None, categories: pd.DataFrame | None = None) list[tuple[int, int, str, str]] [source]#
Convert data to mesh OBJ contents.
- Parameters:
series_key – Simulation series key.
locations_tar – Archive of location data.
frame_spec – Specification for mesh frames.
regions – List of regions.
box – Size of bounding box.
mesh_type – Mesh face type.
group_size – Number of objects in each group (if grouping meshes).
categories – Simulation data containing ID, FRAME, and CATEGORY.
- Returns:
List of mesh frames, indices, regions, and OBJ contents.
- make_mesh_groups(categories: pd.DataFrame, frames: list[int], group_size: int) dict[int, dict[int, list[int]]] [source]#
Group objects based on group size and categories.
- Parameters:
categories – Simulation data containing ID, FRAME, and CATEGORY.
frames – List of frames.
group_size – Number of objects in each group.
- Returns:
Map of frame to map of index to location ids.
- make_individual_mesh(location: dict, length: int, width: int, height: int, region: str, mesh_type: MeshType = MeshType.DEFAULT) str | None [source]#
Create mesh containing a single object.
- Parameters:
location – Location object.
length – Bounding box length.
width – Bounding box width.
height – Bounding box height.
region – Region name.
mesh_type – Mesh face type.
- Returns:
Single mesh OBJ file contents.
- make_combined_mesh(locations: list[dict], length: int, width: int, height: int, region: str, mesh_type: MeshType = MeshType.DEFAULT) str | None [source]#
Create mesh containing multiple objects.
- Parameters:
locations – List of location objects.
length – Bounding box length.
width – Bounding box width.
height – Bounding box height.
region – Region name.
mesh_type – Mesh face type.
- Returns:
Combined mesh OBJ file contents.
- make_mesh_array(voxels: list[tuple[int, int, int]], length: int, width: int, height: int) ndarray [source]#
Generate array from list of voxels.
Given voxel locations are set to the max array level. The array is smoothed such that all other locations are set to the number of max-level neighbors.
- Parameters:
voxels – List of voxels representing object.
length – Bounding box length.
width – Bounding box width.
height – Bounding box height.
- Returns:
Array representing object.
- make_mesh_geometry(array: ndarray, center: list[float], offset: int = 0) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] [source]#
Generate mesh from array.
- Parameters:
array – Array representing object.
center – Coordinate of object center.
offset – Offset for face indices.
- Returns:
Arrays of mesh vertices, faces, and normals.
- make_mesh_file(verts: ndarray, faces: ndarray, normals: ndarray, mesh_type: MeshType = MeshType.DEFAULT) str [source]#
Create mesh OBJ file contents from marching cubes output.
If
- Parameters:
verts – Array of mesh vertices.
faces – Array of mesh faces.
normals – Array of mesh normals.
mesh_type – Mesh face type.
- Returns:
Mesh OBJ file.