Geometry - Primitives

This module provides a set of geometry-mesh interfaces for blender objects.

class bsr.geometry.primitives.simple.Sphere(position, radius, **kwargs)[source]

This class provides a mesh interface for Blender Sphere objects. Sphere objects are created with the given position and radius.

Parameters:
positionNDArray

The position of the sphere object. Expected shape is (n_dim,) n_dim = 3

radiusfloat

The radius of the sphere object.

classmethod create(states)[source]

Basic factory method to create a new Sphere object. States must have the following keys: position(n_dim,), radius(float)

Return type:

Sphere

Parameters:
states: MeshDataType

A dictionary containing the sphere’s center position and radius

Returns:
Sphere

A sphere object with the defined center position and radius

Raises:
Warning
If unused keys are present in the dictionary within states
property material: Material

Access the Blender material.

property object: Object

Access the Blender object.

update_states(position=None, radius=None)[source]

Updates the position and radius of the sphere object.

Return type:

None

Parameters:
positionNDArray

The new position of the sphere object.

radiusfloat

The new radius of the sphere object.

Raises:
ValueError

If the shape of the position or radius is incorrect, or if the data is NaN.

update_material(**kwargs)[source]

Updates the material of the sphere object.

Return type:

None

Parameters:
colorNDArray

The new color of the sphere object in RGBA format.

update_keyframe(keyframe)[source]

Sets a keyframe at the given frame.

Return type:

None

Parameters:
keyframeint
class bsr.geometry.primitives.simple.Cylinder(position_1, position_2, radius, **kwargs)[source]

This class provides a mesh interface for Blender Cylinder objects. Cylinder objects are created with the given endpoint positions and radius.

Parameters:
position_1NDArray

The first endpoint position of the cylinder object. (3D)

position_2NDArray

The second endpoint position of the cylinder object. (3D)

radiusfloat

The radius of the cylinder object.

classmethod create(states)[source]

Basic factory method to create a new Cylinder object.

Return type:

Cylinder

Parameters:
states: MeshDataType

A dictionary containing the cylinder’s endpoint positions and radius

Returns:
Cylinder

A Cylinder object with the defined endpoint positions and radius

Raises:
Warning
If unused keys are present in the dictionary within states
property material: Material

Access the Blender material.

property object: Object

Access the Blender object.

update_states(position_1=None, position_2=None, radius=None)[source]

Updates the position and radius of the cylinder object.

Return type:

None

Parameters:
position_1NDArray

The first new endpoint position of the cylinder object.

position_2NDArray

The second new endpoint position of the cylinder object.

radiusfloat

The new radius of the cylinder object.

Raises:
ValueError

If the shape of the positions or radius is incorrect, or if the data is NaN.

update_material(**kwargs)[source]

Updates the material of the cylinder object.

Return type:

None

Parameters:
kwargsdict

Keyword arguments for the material update.

update_keyframe(keyframe)[source]

Sets a keyframe at the given frame.

Return type:

None

Parameters:
keyframeint