-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
35 lines (30 loc) · 791 Bytes
/
index.ts
File metadata and controls
35 lines (30 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type { Node } from '@xyflow/svelte';
import init from '../../../wasm/pkg/wasm.js';
import { naive } from './naive';
import { rbush } from './rbush';
import { flatbush } from './flatbush';
import { rbushReplace } from './rbushReplace';
import { naiveWasm } from './naiveWasm';
import { geoIndexWasm } from './geoIndex';
import { quadtree } from './quadtree.js';
export type CollisionAlgorithmOptions = {
iterations: number;
overlapThreshold: number;
margin: number;
};
export type CollisionAlgorithm = (
nodes: Node[],
options: CollisionAlgorithmOptions
) => { newNodes: Node[]; numIterations: number };
export const algorithms = {
naive,
naiveWasm,
rbush,
rbushReplace,
flatbush,
geoIndexWasm,
quadtree
} as const;
export async function initWasm() {
await init();
}