@shumoku/core · 0.4.0 · function
bezierOffsetPath
`bezierEdgePath` translated as a whole by `offset` SVG units along the chord-perpendicular direction. Used to draw parallel "in" / "out" lanes for weathermap-style flow overlays. This is a *parallel translate*, NOT a true cubic offset curve (which cannot in general be represented exactly as another cubic). All four control points shift by the same vector, so: • lane spacing is exactly `2 * |offset|` everywhere along the curve, • the offset curve never crosses the base curve or the opposite lane regardless of port-side configuration (incl. same-side U-turns and adjacent-side L-turns), • tangents are preserved at every point — but the lane endpoint is shifted off the port by `(nx, ny)`. Lanes are decorative; they are not meant to "connect to" the port. The shift direction is the chord normal (perpendicular to b-a). Sign convention: in screen coordinates (y-down), `+offset` shifts to the right-hand side of the chord A→B, `-offset` to the left. Pass `+offset` and `-offset` for the two lanes; which one ends up labelled "in" is a data-source semantic, not enforced here. Computed analytically — no DOM measurement, so callers don't need a mounted SVGPathElement.
bezierOffsetPath(from: { absolutePosition: { x: number; y: number }; side?: PortSide }, to: { absolutePosition: { x: number; y: number }; side?: PortSide }, offset: number): string Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
from | { absolutePosition: { x: number; y: number }; side?: PortSide } | No additional description. | — |
to | { absolutePosition: { x: number; y: number }; side?: PortSide } | No additional description. | — |
offset | number | No additional description. | — |
Returns
string