import type { RoutingGrid } from "../contracts/routing_grid.js"; import { IAutorouteWaypoint } from "../types/pcb.js"; import { IRouteDirectives, IRoutePath, IRoutingOptions, NormalizedRoutingOptions } from "./types.js"; export type { IRouteNode, IRoutePath, IRoutingOptions } from "./types.js"; /** * A* pathfinding algorithm for PCB routing. * Finds optimal paths on a routing grid while avoiding obstacles. */ export declare class AStarRouter { private static readonly ROUTING_CONSTANTS; private grid; private options; private freeViaGridLocations; private gridSearch; private waypointPlanner; private clearanceProfile; private coarseGridFactory?; private disableResumeGrid; private requestedGridResolution?; private resumeGridResolution?; private rawOptions; private _mstWorker; private getMstWorker; get routingOptions(): NormalizedRoutingOptions; /** * Create a new A* router. * * @param grid - The routing grid to search on * @param options - Routing options * * @example * ```ts * const router = new AStarRouter(grid, { * traceWidth: 0.2, * clearance: 0.2, * allowedLayers: ['F.Cu'], * viaCost: 5.0, * bendCost: 0.5 * }); * ``` */ constructor(grid: RoutingGrid, options: IRoutingOptions); private recomputePathMetrics; private findEscapeSlice; /** * Optionally reroute the middle of a path on a coarser grid once we've * escaped fine-pitch detail. This mirrors the legacy host-side behavior * but keeps the policy inside the plugin. */ private maybeResumeOnCoarseGrid; /** * Route from start to end point. * * @param start - Starting position in world coordinates (mm) * @param end - Ending position in world coordinates (mm) * @param directives - Optional routing directives (waypoints or vias) * @returns Routing result with path and metadata */ route(start: { x: number; y: number; layer: string; }, end: { x: number; y: number; layer: string; }, directives?: IAutorouteWaypoint[] | IRouteDirectives): IRoutePath; /** * Optimize a routed path using Steiner Minimum Tree algorithm. * Adds Steiner points (intermediate junctions) to reduce total trace length. * * @param path - Initial routed path from MST * @param terminals - Original connection points * @param useSteinerOptimization - Whether to apply Steiner optimization * @returns Optimized path or original if no improvement found */ optimizeWithSteiner(path: IRoutePath, terminals: { x: number; y: number; layer: string; }[], useSteinerOptimization?: boolean): IRoutePath; /** * Route an entire net with multiple connection points using MST (Minimum Spanning Tree). * This finds the optimal routing order to minimize total trace length. * * @param points - Array of connection points to route * @param useSteinerOptimization - Whether to apply Steiner optimization after MST * @returns Routing result with merged path and metadata */ routeNet(points: { x: number; y: number; layer: string; }[], useSteinerOptimization?: boolean): IRoutePath; /** * Multi-resolution net routing: route the net on a coarser grid first, * then refine each coarse path segment on the fine grid. */ private routeNetMultiResolution; /** * Route a single MST edge, optionally through waypoints. * @private */ private routeMSTEdge; private buildMST; /** * Route through a series of waypoints. * @private */ private routeWithWaypoints; /** * Route through a series of forced via locations. * For each via, the router will reach the XY coordinate, insert a layer change, * then continue from the via on the requested layer. */ private routeWithVias; /** * Route a single segment using A*. * Made public to allow Steiner optimizer to re-route through Steiner points. */ routeSegment(start: { x: number; y: number; layer: string; }, end: { x: number; y: number; layer: string; }): IRoutePath; /** * Format time display - show seconds for times >= 1000ms, milliseconds otherwise * @private */ private formatTime; /** * Log routing result with colored output and useful information. * @private */ private logRouteResult; /** * Log net routing result with colored output and useful information. * @private */ private logNetResult; /** * geometry changes outside of this router (e.g., manual edits). */ invalidateCaches(scope?: { windows?: boolean; paths?: boolean; occupancy?: boolean; }): void; /** * Alias for cache invalidation so hosts can uniformly reset router internals * when board obstacles change. */ resetCaches(scope?: { windows?: boolean; paths?: boolean; occupancy?: boolean; }): void; dispose(): void; } //# sourceMappingURL=astar_router.d.ts.map