Geometry - Composite

Rod-like geometry

Rod class for creating and updating rods in Blender

class bsr.geometry.composite.rod.RodWithSphereAndCylinder(positions, radii)[source]

This class provides a mesh interface for Rod objects. Rod objects are created using given positions and radii.

Parameters:
positionsNDArray

The positions of the Rod objects. Expected shape is (n_dim, n_nodes). n_dim = 3

radiiNDArray

The radii of the Rod objects. Expected shape is (n_nodes-1,).

property material: dict[str, list[Material]]

Return the dictionary of Blender materials: sphere and cylinder

property object: dict[str, list[Object]]

Return the dictionary of Blender objects: sphere and cylinder

classmethod create(states)[source]

Basic factory method to create a new Rod object. States must have the following keys: positions(n_dim, n_nodes), radii(n_nodes-1,)

Return type:

RodWithSphereAndCylinder

Parameters:
states: dict[str, NDArray]

A dictionary where keys are state names and values are NDArrays.

Returns:
RodWithSphereAndCylinder

An object of Rod class containing the predefined states

update_states(positions, radii)[source]

Update the states of the Rod object

Return type:

None

Parameters:
positionsNDArray

The positions of the Rod objects. Expected shape is (n_dim, n_nodes)

radiiNDArray

The radii of the Rod objects. Expected shape is (n_nodes-1,)

update_material(**kwargs)[source]

Updates the material of the Rod object

Return type:

None

Parameters:
kwargsdict

Keyword arguments for the material update

update_keyframe(keyframe)[source]

update keyframe for the rod object

Return type:

None

bsr.geometry.composite.rod.Rod

alias of RodWithSphereAndCylinder

class bsr.geometry.composite.rod.RodWithCylinder(positions, radii)[source]

Rod class for managing visualization and rendering in Blender

This class only creates cylinder objects

Parameters:
positionsNDArray

The positions of the sphere objects. Expected shape is (n_dim, n_nodes). n_dim = 3

radiiNDArray

The radii of the sphere objects. Expected shape is (n_nodes-1,).

update_states(positions, radii)[source]

Update the states of the rod object

Return type:

None

Parameters:
positionsNDArray

The positions of the sphere objects. Expected shape is (n_nodes, 3).

radiiNDArray

The radii of the sphere objects. Expected shape is (n_nodes-1,).

update_material(**kwargs)[source]

Updates the material of the Rod object

Return type:

None

Parameters:
kwargsdict

Keyword arguments for the material update

update_keyframe(keyframe)[source]

Set keyframe for the rod object

Return type:

None

class bsr.geometry.composite.rod.RodWithBox(positions, radii, directors)[source]

Rod class for managing visualization and rendering in Blender

This class creates sphere objects to represent position and cube to represent director

Parameters:
positionsNDArray

The positions of the sphere objects. Expected shape is (n_dim, n_nodes). n_dim = 3

radiiNDArray

The radii of the sphere objects. Expected shape is (n_nodes-1,).

property material: dict[str, list[Material]]

Return the dictionary of Blender materials: sphere and cylinder

property object: dict[str, list[Object]]

Return the dictionary of Blender objects: sphere and cylinder

classmethod create(states)[source]

Basic factory method to create a new Rod object. States must have the following keys: positions(n_dim, n_nodes), radii(n_nodes-1,)

Return type:

RodWithBox

Parameters:
states: dict[str, NDArray]

A dictionary where keys are state names and values are NDArrays.

Returns:
RodWithSphereAndCylinder

An object of Rod class containing the predefined states

update_states(positions, radii, directors)[source]

Update the states of the rod object

Return type:

None

Parameters:
positionsNDArray

The positions of the sphere objects. Expected shape is (n_nodes, 3).

radiiNDArray

The radii of the sphere objects. Expected shape is (n_nodes-1,).

update_material(**kwargs)[source]

Updates the material of the Rod object

Return type:

None

Parameters:
kwargsdict

Keyword arguments for the material update

update_keyframe(keyframe)[source]

Set keyframe for the rod object

Return type:

None

Stacked geometry

class bsr.geometry.composite.stack.BaseStack[source]

This class provides a mesh interface for a BaseStack of objects. BaseStacks are created using given positions and radii.

Parameters:
positions: NDArray

Positions of each object in the stack. Expected dimension is (n_dim, n_nodes) n_dim = 3

radii: NDArray

Radii of each object in the stack. Expected dimension is (n_nodes-1,)

property material: list[BlenderMeshInterfaceProtocol]

Returns the list of materials in the stack.

property object: list[BlenderMeshInterfaceProtocol]

Returns the list of objects in the stack.

update_keyframe(keyframe)[source]

Sets a keyframe at the given frame.

Return type:

None

classmethod create(states)[source]

Basic factory method to create a new BaseStack of objects. States must have the following keys: positions(n_dim, n_nodes), radii(n_nodes-1,)

Return type:

Self

Parameters:
states: dict[str, NDArray]

A dictionary where keys are state names and values are NDarrays.

Returns:
Self

An instance of the BaseStack with objects containing the states

Raises:
AssertionError

If the states have differing lengths

update_states(*variables)[source]

Updates the states of the BaseStack objects.

Return type:

None

Parameters:
*variables: NDArray

An array including all the state updates of the object in the stack. Expected dimension is (n_nodes - 1,)

update_material(**kwargs)[source]

Updates the material of the BaseStack objects

Return type:

None

Parameters:
kwargsdict

Keyword arguments for the material update

class bsr.geometry.composite.stack.RodStack[source]

This class provides a mesh interface for a RodStack of objects (only contains Rod objects). RodStacks are created using given positions and radii.

Parameters:
positions: NDArray

Positions of each Rod in the stack. Expected dimension is (n_dim, n_nodes). n_dim = 3

radii: NDArray

Radii of each Rod in the stack. Expected dimension is (n_nodes-1,).

DefaultType

alias of RodWithSphereAndCylinder

bsr.geometry.composite.stack.create_rod_collection(states)

Basic factory method to create a new BaseStack of objects. States must have the following keys: positions(n_dim, n_nodes), radii(n_nodes-1,)

Return type:

Self

Parameters:
states: dict[str, NDArray]

A dictionary where keys are state names and values are NDarrays.

Returns:
Self

An instance of the BaseStack with objects containing the states

Raises:
AssertionError

If the states have differing lengths

Pose geometry

Pose class for creating and updating poses in Blender

class bsr.geometry.composite.pose.Pose(positions, directors, unit_length=1.0, thickness_ratio=0.1)[source]

This class provides a mesh interface for Pose objects. Pose objects are created using given positions and directors.

Parameters:
positionsNDArray

The positions of pose. Expected shape is (n_dim,). n_dim = 3

directorsNDArray

The directors of the pose. Expected shape is (n_dim, n_dim). n_dim = 3

property material: dict[str, Material]

Return the dictionary of Blender materials: spheres and cylinders

property object: dict[str, Object]

Return the dictionary of Blender objects: spheres and cylinders

classmethod create(states)[source]

Basic factory method to create a new Pose object. States must have the following keys: positions(n_dim,), directors(n_dim, n_dim)

Return type:

Pose

Parameters:
states: dict[str, NDArray]

A dictionary where keys are state names and values are NDArrays.

Returns:
Pose

An object of Pose class containing the predefined states

update_states(positions, directors)[source]

Update the states of the Pose object

Return type:

None

Parameters:
positions: NDArray

The positions of the Pose objects. Expected shape is (n_dim,)

directors: NDArray

The directors of the Pose objects. Expected shape is (n_dim, n_dim)

update_material(**kwargs)[source]

Updates the material of the Pose object

Return type:

None

Parameters:
kwargsdict

Keyword arguments for the material update

update_keyframe(keyframe)[source]

Set the keyframe for the pose object

Return type:

None