import type { RoutingGrid } from "../contracts/routing_grid.js"; import type { IRoutePath, NormalizedRoutingOptions, RouteEndpoint } from "./types.js"; import { ClearanceProfile } from "./clearance_profile.js"; export interface GridSearchConfig { grid: RoutingGrid; options: NormalizedRoutingOptions; freeViaGridLocations: Set; clearanceProfile: ClearanceProfile; } /** * Standalone single-segment router built on top of the routing grid. * AStarRouter composes this helper for every segment/waypoint hop as well * as Steiner re-routing. */ export declare class GridSearch { private grid; private options; private freeViaGridLocations; private clearanceProfile; private windowCache; private pathCache; private pathCacheOrder; private globalOccupancyCache; private layerCodeMap; private nextLayerCode; private openMapArr; private closedSet; private localOccupancyCache; private searchGeneration; private openMapTouchedIndices; private openPQ; private static readonly MAX_PATH_CACHE_ENTRIES; private static readonly MAX_GLOBAL_OCCUPANCY_CACHE_ENTRIES; private static readonly ANGLE_TOLERANCE; constructor(config: GridSearchConfig); /** * Clears cached data. Allows callers to selectively drop expensive caches * when the host board changes underneath the router. */ resetCaches(scope?: { windows?: boolean; paths?: boolean; occupancy?: boolean; }): void; private buildPathCacheKey; private tryReuseCachedPath; private isCachedPathValid; private storePathCache; private cloneRoutePath; private getWindowCacheKey; private getOrCreateWindowData; private expandWindowData; private canReusePreviousWindow; private buildLayerOrderWithReuse; private buildWindowData; private mergeWindows; private sampleCellCost; private runSearchWithWindow; findPath(start: RouteEndpoint, end: RouteEndpoint): IRoutePath; private static readonly DIRECTIONS_4WAY; private static readonly DIRECTIONS_8WAY; private getNeighbors; private jump; private makeSingleStepNeighbor; private reconstructPath; /** * Removes intermediate points that lie on a straight line between their neighbors. * This eliminates unnecessary "zigzag" patterns where a trace goes 45° then back 45° * when it could just continue straight, or similar redundant bends. */ private removeCollinearPoints; /** * Checks if three points are collinear (lie on the same line). * Uses cross product to detect collinearity with a small tolerance. */ private isCollinear; /** * Removes redundant intermediate points near the start/end of a path. * These can occur when endpoint snapping creates a pattern like: * pad → nearby grid point → main route direction * The nearby grid point often creates an ugly "zigzag" pattern and should * be removed even if it means the resulting segment isn't at a perfect * 45°/90° angle - small deviations are visually acceptable. */ private removeRedundantNearEndpoints; /** * Prevents placing vias directly adjacent to pads by checking * for pad cells within a clearance radius on both involved layers. */ private isPadWithinClearance; private getDirectionalPenalty; private ensureAllowedRunAngles; private isAllowedRunSegment; private splitIntoAllowedSegments; private hasForcedNeighbor; private buildLayerOrder; private buildSearchWindow; private isWithinWindow; private getLayerCode; private buildGlobalOccupancyKey; dispose(): void; private storeGlobalOccupancyValue; } export declare function heuristicDistance(x1: number, y1: number, layer1: string, x2: number, y2: number, layer2: string, viaPenalty?: number, congestionPenalty?: number, allowDiagonalRuns?: boolean): number; export declare const GridSearchConstants: { NON_PREFERRED_LAYER_PENALTY: number; TH_GOAL_VIA_AVOID_RADIUS_MM: number; TH_START_VIA_AVOID_RADIUS_MM: number; SEARCH_WINDOW_PADDING_MM: number; }; //# sourceMappingURL=grid_search.d.ts.map