MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / _elbow

Function _elbow

SLiCAP/schematic/canvas.py:73–80  ·  view source on GitHub ↗

Return the two or three points needed to route from p1 to p2.

(p1: QPointF, p2: QPointF, h_first: bool)

Source from the content-addressed store, hash-verified

71
72
73def _elbow(p1: QPointF, p2: QPointF, h_first: bool) -> list[QPointF]:
74 """Return the two or three points needed to route from p1 to p2."""
75 dx = abs(p1.x() - p2.x())
76 dy = abs(p1.y() - p2.y())
77 if dx < 0.1 or dy < 0.1: # already aligned
78 return [p1, p2]
79 mid = QPointF(p2.x(), p1.y()) if h_first else QPointF(p1.x(), p2.y())
80 return [p1, mid, p2]
81
82
83# ── junction detection ────────────────────────────────────────────────────────

Callers 4

_refresh_previewMethod · 0.85
mousePressEventMethod · 0.85
mouseMoveEventMethod · 0.85
mouseReleaseEventMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected