Compare commits
3 Commits
31d88b729e
...
de534a755f
| Author | SHA1 | Date | |
|---|---|---|---|
| de534a755f | |||
| 41bbfee80b | |||
| c7a8fac890 |
@ -473,8 +473,8 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||
class Transition:
|
||||
""" Description of a pre-rendered transition """
|
||||
abstract: Abstract
|
||||
our_port_name: str
|
||||
their_port_name: str
|
||||
our_port_name: str
|
||||
|
||||
@property
|
||||
def our_port(self) -> Port:
|
||||
@ -511,7 +511,7 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||
""" Default value for out_ptype """
|
||||
|
||||
def add_complementary_transitions(self) -> Self:
|
||||
for iioo in self.transitions:
|
||||
for iioo in list(self.transitions.keys()):
|
||||
ooii = (iioo[1], iioo[0])
|
||||
self.transitions.setdefault(ooii, self.transitions[iioo].reversed())
|
||||
return self
|
||||
@ -535,6 +535,8 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||
|
||||
tree, pat = Library.mktree(SINGLE_USE_PREFIX + 'path')
|
||||
pat.add_port_pair(names=port_names, ptype='unk' if in_ptype is None else in_ptype)
|
||||
if data.in_transition:
|
||||
pat.plug(data.in_transition.abstract, {port_names[1]: data.in_transition.their_port_name})
|
||||
if not numpy.isclose(data.straight_length, 0):
|
||||
straight_pat_or_tree = data.straight.fn(data.straight_length, **kwargs)
|
||||
if isinstance(straight_pat_or_tree, Pattern):
|
||||
@ -574,7 +576,7 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||
def _itransition2dxy(in_transition: Transition | None) -> NDArray[numpy.float64]:
|
||||
if in_transition is None:
|
||||
return numpy.zeros(2)
|
||||
irot = in_transition.our_port.rotation
|
||||
irot = in_transition.their_port.rotation
|
||||
assert irot is not None
|
||||
itrans_dxy = rotation_matrix_2d(-irot) @ (in_transition.our_port.offset - in_transition.their_port.offset)
|
||||
return itrans_dxy
|
||||
@ -615,8 +617,8 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
||||
otrans_dxy = self._otransition2dxy(out_transition, bend_angle)
|
||||
|
||||
b_transition = None
|
||||
if ccw is not None and bend.out_port.ptype != straight.ptype:
|
||||
b_transition = self.transitions.get((bend.out_port.ptype, straight.ptype), None)
|
||||
if ccw is not None and bend.in_port.ptype != straight.ptype:
|
||||
b_transition = self.transitions.get((bend.in_port.ptype, straight.ptype), None)
|
||||
btrans_dxy = self._itransition2dxy(b_transition)
|
||||
|
||||
straight_length = length - bend_dxy[0] - itrans_dxy[0] - btrans_dxy[0] - otrans_dxy[0]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user