routing.core.world#
Custom world class for routing.
- class routing.core.world.SmartWorld(grids: dict[int, SmartGrid], world_matrix_shape: tuple[int, int, int], design_rules: list[DesignRule], world_origin: tuple[float, float, float], voxel_size: float)[source]#
Bases:
World,SmartGridInterfaceA class representing a world that connects multiple SmartGrids, allowing for pathfinding across them.
This class inherits from World and SmartGridInterface, and enables multi-grid and multi-scale pathfinding by connecting multiple SmartGrid objects with potentially different voxel sizes and origins. It provides a unified interface for pathfinding across grid boundaries.
- Parameters:
grids – The dictionary mapping grid IDs to SmartGrid instances. Each grid can have different voxel sizes and origins.
world_matrix_shape – The overall world dimensions as (width, height, depth) in voxels at the coarsest scale.
world_origin – The origin point of the world in global coordinates as (x, y, z) tuple.
voxel_size – The coarsest voxel size (used for world-scale coordinates). Should match max_voxel_size of all grids.
- block_ports_tail(start: GridPort, end: GridPort, radius: float) None[source]#
Block voxels between port and extension for avoiding self interference in generation.
- property decomposition: list[dict[str, tuple[int, int]]]#
Compute decomposition bounds from grid specifications.
- extend_port_multi_scale(port: Port, port_length: float) SmartGridNode[source]#
Extend port in its orientation direction by given length (multi-scale aware).
- property is_multi_scale: bool#
Check if the world contains multiple scales.
- property nbytes: int#
Calculate the total memory usage in bytes of all grids in SmartWorld.
- node(x: int, y: int, z: int, grid_id: int | None = None, return_all: bool = False) SmartGridNode | list[SmartGridNode] | None[source]#
Get node(s) at the specified coordinates.
- Parameters:
x – X coordinate (in world scale if no grid_id, local scale otherwise)
y – Y coordinate
z – Z coordinate
grid_id – If specified, look in this specific grid with local coordinates
return_all – If True and is_multi_scale, return all nodes at this position
- Returns:
Single node, list of nodes (if return_all), or None