scene_synthesizer.utils

Classes

PositionIterator2D([seed])

PositionIterator3D([seed])

PositionIteratorDisk(r, center[, seed])

Sample positions on a 2D plane uniformly within a disk of radius r and center

PositionIteratorFarthestPoint([sample_count])

PositionIteratorGaussian(params[, seed])

Gaussian 2D position sampler

PositionIteratorGrid(step_x, step_y[, ...])

PositionIteratorList(positions)

PositionIteratorPoissonDisk([k, r, seed])

PositionIteratorUniform([seed])

PositionIteratorUniform3D([seed])

Functions

above_and_aligned_right_back()

Helper function that returns arguments for add_object(..).

add_extents_to_trimesh_metadata(mesh_or_scene)

Add extents to trimesh scene or individual mesh.

add_filename_to_trimesh_metadata(...[, ...])

Add file_path and file_name properties to trimesh scene or individual mesh.

add_node_to_scene(scene, **kwargs)

Add a new node (and edge) to the scene graph.

adjust_color([color, brightness, ...])

Adjust the brightness and transparency of a color.

append_scenes(iterable[, common, ...])

Concatenate multiple scene objects into one scene.

center_mass(trimesh_scene, node_names)

Return the center of mass of a selection of nodes in a scene.

collision_manager_get_transforms(...)

Helper function to get a dictionary of all object transformations in a collision manager.

collision_manager_set_transforms(...)

Helper function to set all transformations in a collision manager.

collision_manager_transform(...[, premultiply])

Helper function to transform all objects of a collision manager.

construct_obj_collision_manager(scene, transform)

Return a trimesh collision manager for a trimesh scene, with a pre-multiplied transform for all objects.

cq_to_trimesh(cq_object[, tolerance])

Convert cadquery object into Trimesh.

create_torus(major_radius, minor_radius[, ...])

Create torus mesh.

create_yourdfpy_scene(yourdfpy_model, ...[, ...])

This function builds a trimesh scene from a yourdfpy model.

cycle_list(l, perm)

Generator function to cycle infinitely through a fixed order of elements.

distribute_center_mass(center_mass, geoms)

Return center-of-masses for each geom_type_etry based on a single desired joint CoM.

forward_kinematics(scene[, joint_names, ...])

Helper function to update the scene graph by running forward kinematics on all edges specified through joint_names.

get_mass_properties(trimesh_geometry[, ...])

Calculate mass properties of trimesh geometry; even if not watertight.

get_random_filename(suffix[, prefix, dir])

Generate a random 8-character file name that won't exist in the provided directory.

get_reference_frame(bounds, center_mass, ...)

get_transform(trimesh_scene, frame_to[, ...])

get_watertight_trimesh_geometry(trimesh_geometry)

Returns a watertight version of a trimesh geometry.

hash_trimesh_geometry_metadata(geom)

Return a hash value for the metadata of trimesh.Geometry

homogeneous_inv(matrix)

Inverse homogeneous matrix.

invalidate_scenegraph_cache(scene)

Invalidate cache of scene's graph.

is_regex(string)

Unofficial check whether a string is a regular expression, based on special characters (except '/' which is used for namespacing in scene_synthesizer).

late_bind_exception(exc)

Helper to bind exceptions to function calls, e.g. when an import fails but import is only used for specific functionality.

left_and_aligned_back_bottom()

Helper function that returns arguments for add_object(..).

max_support_area_generator(support_data)

normalize_and_bake_scale(trimesh_scene)

Takes a trimesh scene and bakes all scale information contained in the transform tree into the vertices of all meshes.

object_id_generator(base_name)

orientation_generator_const(orientation)

orientation_generator_stable_poses(asset[, seed])

Generator that yields random homogeneous transformations that represent stable poses of an asset.

orientation_generator_uniform_around_z([...])

Generator that yields homogeneous transformations that are randomly rotated around the z axis.

random_color([dtype, seed])

Return a random RGB color using datatype specified.

random_id_generator([base_name])

right_and_aligned_back_bottom()

Helper function that returns arguments for add_object(..).

sample_polygon(polygon, count[, factor, ...])

Use rejection sampling to generate random points inside a polygon.

sample_random_direction_R3(number_of_directions)

Uniformly distributed directions on S2.

sample_volume_mesh(mesh, count[, seed])

Use rejection sampling to produce points randomly distributed in the volume of a mesh.

scaled_trimesh_scene(scene, scale)

Return a copy of the trimesh scene, with meshes and scene transforms scaled to the requested factor.

select_sublist(query, all_items)

Select a sublist of a given list, using a query.

snake_case(s)

Return string s in snake_case.

support_area_generator(support_data[, seed])

A generator that randomly returns supports.