mymesh.converter.surf2voxel#

mymesh.converter.surf2voxel(SurfCoords, SurfConn, h, Octree='generate', mode='any')[source]#

Convert a surface mesh to a filled voxel mesh. The surface must be closed to work properly, unexpected behavior could occur with unclosed surfaces.

Parameters:
  • SurfCoords (array_like) – Node coordinates of the surface mesh

  • SurfConn (array_like) – Node connectivity of the surface mesh

  • h (float) – Voxel size for the output mesh.

  • Octree (str, octree.OctreeNode, None, optional) – Octree setting, by default ‘generate’. ‘generate’ will construct an octree for use in creating the voxel mesh, None will not use an octree. Alternatively, if an existing octree structure exists, that can be provided.

  • mode (str, optional) – Mode for determining which elements are kept, by default ‘any’. Voxels will be kept if: ‘any’ - if any node of a voxel is inside the surface, ‘all’ - if all nodes of a voxel are inside the surface, ‘centroid’ - if the centroid of the voxel is inside the surface.

Returns:

  • VoxelCoords (np.ndarray) – Node coordinates of the voxel mesh

  • VoxelConn (np.ndarray) – Node connectivity of the voxel mesh