Skip to content

TransformationManager

TransformationManager

TransformationManager(mesh_maker: Model)

Local manager for geometric transformation lifecycle and tag assignment.

Create an empty transformation manager with tags starting at 1.

Attributes

_mesh_maker instance-attribute

_mesh_maker = mesh_maker

_transformations instance-attribute

_transformations: Dict[int, GeometricTransformation] = {}

_start_tag instance-attribute

_start_tag = 1

_tagging instance-attribute

_tagging = CompactRetagPolicy[GeometricTransformation]()

Methods:

__len__

__len__() -> int

Return the number of managed transformations.

__iter__

__iter__() -> Iterator[GeometricTransformation]

Iterate over managed transformations in tag order.

add

add(transformation: GeometricTransformation) -> GeometricTransformation

Add an existing transformation and assign a tag if needed.

Parameters:

Name Type Description Default
transformation GeometricTransformation

Unmanaged or already-managed transformation.

required

Returns:

Type Description
GeometricTransformation

The same transformation after it is stored by this manager.

get

get(tag: int) -> Optional[GeometricTransformation]

Return the transformation with tag if it exists.

get_all

get_all() -> Dict[int, GeometricTransformation]

Return a shallow copy of all managed transformations keyed by tag.

remove

remove(tag: int) -> None

Remove a managed transformation and compact the remaining tags.

clear

clear() -> None

Remove all transformations and clear their assigned tags.

set_tag_start

set_tag_start(start_tag: int) -> None

Set the first tag used by this manager and retag existing objects.

transformation2d

transformation2d(transf_type: str, d_xi: float = 0.0, d_yi: float = 0.0, d_xj: float = 0.0, d_yj: float = 0.0, description: str = '') -> GeometricTransformation2D

Create and manage a 2D geometric transformation.

transformation3d

transformation3d(transf_type: str, vecxz_x: float | str, vecxz_y: float | str, vecxz_z: float | str, d_xi: float | str = 0.0, d_yi: float | str = 0.0, d_zi: float | str = 0.0, d_xj: float | str = 0.0, d_yj: float | str = 0.0, d_zj: float | str = 0.0, description: str = '') -> GeometricTransformation3D

Create and manage a 3D geometric transformation.

_next_available_tag

_next_available_tag() -> int

Return the next unused tag in this manager's local tag space.

_reassign_tags

_reassign_tags() -> None

Retag all managed transformations from _start_tag in tag order.