fixup! [AutoTool] Use more dataclasses to clarify internal code

This commit is contained in:
Jan Petykiewicz 2025-11-12 23:34:23 -08:00
parent 41bbfee80b
commit de534a755f

View File

@ -576,7 +576,7 @@ class AutoTool(Tool, metaclass=ABCMeta):
def _itransition2dxy(in_transition: Transition | None) -> NDArray[numpy.float64]: def _itransition2dxy(in_transition: Transition | None) -> NDArray[numpy.float64]:
if in_transition is None: if in_transition is None:
return numpy.zeros(2) return numpy.zeros(2)
irot = in_transition.our_port.rotation irot = in_transition.their_port.rotation
assert irot is not None assert irot is not None
itrans_dxy = rotation_matrix_2d(-irot) @ (in_transition.our_port.offset - in_transition.their_port.offset) itrans_dxy = rotation_matrix_2d(-irot) @ (in_transition.our_port.offset - in_transition.their_port.offset)
return itrans_dxy return itrans_dxy
@ -617,8 +617,8 @@ class AutoTool(Tool, metaclass=ABCMeta):
otrans_dxy = self._otransition2dxy(out_transition, bend_angle) otrans_dxy = self._otransition2dxy(out_transition, bend_angle)
b_transition = None b_transition = None
if ccw is not None and bend.out_port.ptype != straight.ptype: if ccw is not None and bend.in_port.ptype != straight.ptype:
b_transition = self.transitions.get((bend.out_port.ptype, straight.ptype), None) b_transition = self.transitions.get((bend.in_port.ptype, straight.ptype), None)
btrans_dxy = self._itransition2dxy(b_transition) btrans_dxy = self._itransition2dxy(b_transition)
straight_length = length - bend_dxy[0] - itrans_dxy[0] - btrans_dxy[0] - otrans_dxy[0] straight_length = length - bend_dxy[0] - itrans_dxy[0] - btrans_dxy[0] - otrans_dxy[0]