mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
26 lines (25 loc) • 1.29 kB
TypeScript
import type { Edge, Node } from '../../../types.js';
import type { Point, RectBounds, RectEntry, RectSide } from './geometry.js';
/**
* The faces and routes the passes that move a terminal leg agree on: whether a face is free,
* and whether a moved route stays clear of the other edges and the nodes.
*/
/** How close two coordinates must be to count as equal. */
export declare const EPS = 0.001;
/** One face of a node's bounding box. */
export interface NodeFace {
node: Node;
rect: RectBounds;
side: RectSide;
}
export interface Obstacles {
realNodeRects: RectEntry[];
labelNodeRects: RectEntry[];
}
export declare const runsAlongFace: (side: RectSide) => "x" | "y";
/** No edge but `edge` meets the node through the face, so a route moved there lands on a free port. */
export declare function faceIsOwn(face: NodeFace, edge: Edge, edges: Edge[]): boolean;
/** The moved route keeps clear of every other edge at least as well as the current one. */
export declare function clearOfOtherEdges(edge: Edge, current: Point[], moved: Point[], edges: Edge[]): boolean;
/** The moved route passes no node but its own endpoints at its ends, and no label but its own. */
export declare function clearOfNodes(edge: Edge, moved: Point[], obstacles: Obstacles): boolean;