Refactor shapes

This commit is contained in:
schmelczerandras 2020-08-16 10:24:12 +02:00
parent eb39846b75
commit 006ab3c4e6
24 changed files with 203 additions and 256 deletions

View file

@ -1,7 +1,7 @@
import { ImmutableBoundingBox } from './immutable-bounding-box';
// source: https://github.com/ubilabs/kd-tree-javascript/blob/master/kdTree.js
import { ImmutableBoundingBox } from '../../shapes/immutable-bounding-box';
class Node {
public left?: Node = null;
public right?: Node = null;
@ -63,20 +63,6 @@ export class BoundingBoxTree {
}
}
public print() {
this.printRecursive(this.root, 0);
}
private printRecursive(node: Node, tabCount: number) {
if (node === null) {
return;
}
console.log(' '.repeat(tabCount) + '- ' + node.rectangle.value);
this.printRecursive(node.left, tabCount + 2);
this.printRecursive(node.right, tabCount + 2);
}
public findIntersecting(
box: ImmutableBoundingBox
): Array<ImmutableBoundingBox> {