curobo.geom.sphere_fit module

class SphereFitType(value)

Bases: Enum

Supported sphere fit types are listed here. VOXEL_VOLUME_SAMPLE_SURFACE works best.

See Geometry Approximation to Spheres for more details.

SAMPLE_SURFACE = 'sample_surface'

samples the surface of the mesh to approximate geometry

VOXEL_SURFACE = 'voxel_surface'

voxelizes the volume and returns voxel positions that are intersecting with surface.

VOXEL_VOLUME = 'voxel_volume'

voxelizes the volume and returns all ocupioed voxel positions.

VOXEL_VOLUME_INSIDE = 'voxel_volume_inside'

voxelizes the volume and returns voxel positions that are inside the surface of the geometry

VOXEL_VOLUME_SAMPLE_SURFACE = 'voxel_volume_sample_surface'

voxelizes the volume and returns voxel positions that are inside the surface, along with surface sampled positions

sample_even_fit_mesh(
mesh: Trimesh,
n_spheres: int,
sphere_radius: float,
)
get_voxel_pitch(
mesh: Trimesh,
n_cubes: int,
)
voxel_fit_surface_mesh(
mesh: Trimesh,
n_spheres: int,
sphere_radius: float,
voxelize_method: str = 'ray',
)
get_voxelgrid_from_mesh(
mesh: Trimesh,
n_spheres: int,
voxelize_method: str = 'ray',
)

Get voxel grid from mesh using trimesh.voxel.creation.voxelize.

voxel_fit_mesh(
mesh: Trimesh,
n_spheres: int,
surface_sphere_radius: float,
voxelize_method: str = 'ray',
)
voxel_fit_volume_sample_surface_mesh(
mesh: Trimesh,
n_spheres: int,
surface_sphere_radius: float,
voxelize_method: str = 'ray',
)
voxel_fit_volume_inside_mesh(
mesh: Trimesh,
n_spheres: int,
voxelize_method: str = 'ray',
)
fit_spheres_to_mesh(
mesh: Trimesh,
n_spheres: int,
surface_sphere_radius: float = 0.01,
fit_type: SphereFitType = SphereFitType.VOXEL_VOLUME_SAMPLE_SURFACE,
voxelize_method: str = 'ray',
) Tuple[ndarray, List[float]]

Approximate a mesh with spheres. See Geometry Approximation to Spheres for more details.

Parameters:
  • mesh – Input trimesh

  • n_spheres – _description_

  • surface_sphere_radius – _description_. Defaults to 0.01.

  • fit_type – _description_. Defaults to SphereFitType.VOXEL_VOLUME_SAMPLE_SURFACE.

  • voxelize_method – _description_. Defaults to “ray”.

Returns:

_description_