Bound search memory and verify process geometry before layout export
This commit is contained in:
parent
facde64f09
commit
e6ae242cb2
1 changed files with 645 additions and 102 deletions
|
|
@ -24,6 +24,7 @@ if TYPE_CHECKING:
|
|||
|
||||
from inire.geometry.components import ComponentResult
|
||||
from inire.geometry.primitives import Port
|
||||
from inire.model import RoutingProblem
|
||||
|
||||
|
||||
_RAY_CAST_CACHE_LIMIT = 8192
|
||||
|
|
@ -128,6 +129,19 @@ class RoutingWorld:
|
|||
self._static_obstacles = StaticObstacleIndex(self)
|
||||
self._dynamic_paths = DynamicPathIndex(self)
|
||||
|
||||
@classmethod
|
||||
def from_problem(cls, problem: RoutingProblem, *, board: Polygon | None = None) -> RoutingWorld:
|
||||
world = cls(
|
||||
clearance=problem.clearance,
|
||||
safety_zone_radius=problem.safety_zone_radius,
|
||||
board=box(*problem.bounds) if board is None else board,
|
||||
self_clearance=problem.self_clearance,
|
||||
)
|
||||
reserved_ids = {id(polygon) for polygon in problem._reserved_obstacles}
|
||||
for obstacle in problem.static_obstacles:
|
||||
world.add_static_obstacle(obstacle, reserved=id(obstacle) in reserved_ids)
|
||||
return world
|
||||
|
||||
def get_static_version(self) -> int:
|
||||
return self._static_obstacles.version
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue