summaryrefslogtreecommitdiff
path: root/modules/KDTree.js
blob: d9133d1f39eaf7f9eb7edf1e8fd49a786f131655 (plain)
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
'use strict';

class NodeType {
	static Leaf = new NodeType('Leaf');
	static Branch = new NodeType('Branch');

	constructor(name) { this.name = name; }
	toString() { return `NodeType.${this.name}`; }
}


class LeafNode {
	constructor(point) {
		this.type = NodeType.Leaf;
		this.point = point;
	}
}
class BranchNode {
}


class KDTree {
	constructor() {
		this.root = null;
	}

	insert(point) {
		this.root = new LeafNode(point);
	}
}

export { KDTree, NodeType, LeafNode, BranchNode };
export default KDTree;