@rxflow/manhattan
Version:
Manhattan routing algorithm for ReactFlow - generates orthogonal paths with obstacle avoidance
34 lines • 1.25 kB
TypeScript
import { Point } from '../geometry';
import type { ResolvedOptions, NodeLookup } from '../options';
/**
* ObstacleMap class for managing obstacles in pathfinding
* Uses a grid-based spatial partitioning for efficient queries
*/
export declare class ObstacleMap {
private options;
private mapGridSize;
private map;
private sourceAnchor?;
private targetAnchor?;
constructor(options: ResolvedOptions);
/**
* Build obstacle map from node lookup
*/
build(nodeLookup: NodeLookup, sourceNodeId: string, targetNodeId: string, sourceAnchor?: Point, targetAnchor?: Point): ObstacleMap;
/**
* Shrink bbox to exclude the area around the anchor point
* This allows paths to start/end at the anchor but prevents crossing the node
*/
private shrinkBBoxAroundAnchor;
/**
* Check if a point is accessible (not inside any obstacle)
* Uses binary search optimization: step -> step/2 -> step/4 -> ... -> 1px
*/
isAccessible(point: Point, checkRadius?: number): boolean;
/**
* Check accessibility using binary search optimization
* Tries step -> step/2 -> step/4 -> ... -> 1px
*/
private isAccessibleWithBinarySearch;
}
//# sourceMappingURL=ObstacleMap.d.ts.map