UNPKG

js-subpcd

Version:

🌟 High-performance JavaScript/TypeScript QuadTree point cloud filtering and processing library. Published on npm as js-subpcd with PCL.js compatible API for spatial filtering, subsampling, and nearest neighbor search.

89 lines (88 loc) • 2.15 kB
/** * WebAssembly QuadTree Wrapper for Node.js * Provides seamless integration between WASM and JavaScript implementations */ export interface TreeInfo { type: 'wasm' | 'javascript'; instance: any; pointCount: number; } export interface Bounds { minX: number; minY: number; maxX: number; maxY: number; } export interface WASMPoint { x: number; y: number; z: number; } /** * QuadTree WASM Wrapper for Node.js environment */ export declare class QuadTreeWASMWrapper { private wasmModule; private wasmInstance; private isWasmReady; private isLoading; private fallbackQuadTree; private useFallback; private wasmTreeData; private readonly WASM_THRESHOLD; constructor(); /** * Load WebAssembly module */ private loadWasm; /** * Wait for WASM to load with timeout */ private waitForWasm; /** * Determine if WASM should be used based on point count */ private shouldUseWasm; /** * Build tree using either WASM or JavaScript fallback */ buildTree(points: WASMPoint[], bounds: Bounds): Promise<TreeInfo>; /** * Build tree using WebAssembly */ private buildTreeWasm; /** * Build tree using JavaScript fallback */ private buildTreeJS; /** * Filter points by depth using grid-based subsampling */ filterByDepth(treeInfo: TreeInfo, targetDepth: number): WASMPoint[]; /** * Fallback JavaScript grid-based subsampling */ private fallbackGridSubsampling; /** * Query range using appropriate implementation */ queryRange(treeInfo: TreeInfo, x: number, y: number, width: number, height: number): WASMPoint[]; /** * Convert WASM array to JavaScript array */ private convertWasmArrayToJS; /** * Clear tree data */ clear(treeInfo: TreeInfo): void; /** * Get performance information */ getPerformanceInfo(): { wasmReady: boolean; usingFallback: boolean; wasmThreshold: number; wasmSupported: boolean; }; } export default QuadTreeWASMWrapper;