40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
|
import { PhysicsObject } from './object';
|
||
|
import { Vec3 } from './vec3';
|
||
|
export declare class Octree {
|
||
|
private dimensions;
|
||
|
private maxObjects;
|
||
|
private maxLevels;
|
||
|
root: OcTreeNode;
|
||
|
constructor(dimensions: Vec3, maxObjects?: number, maxLevels?: number);
|
||
|
insert(obj: PhysicsObject): void;
|
||
|
find(position: Vec3, dimensions: Vec3): PhysicsObject[];
|
||
|
}
|
||
|
export declare class OcTreeNode {
|
||
|
private position;
|
||
|
private dimensions;
|
||
|
private maxLevels;
|
||
|
private maxObjects;
|
||
|
private currentLevel;
|
||
|
objects: PhysicsObject[];
|
||
|
nodes: OcTreeNode[];
|
||
|
constructor(position: Vec3, dimensions: Vec3, maxLevels: number, maxObjects: number, currentLevel?: number);
|
||
|
insert(obj: PhysicsObject): any;
|
||
|
find(x: number, y: number, z: number, xw: number, yh: number, zd: number): PhysicsObject[];
|
||
|
split(): void;
|
||
|
private distributeObjectsToNodes;
|
||
|
getIndex(x: number, y: number, z: number): Direction;
|
||
|
getIndeciesForRect(x: number, y: number, z: number, xw: number, yh: number, zd: number): Direction[];
|
||
|
}
|
||
|
declare enum Direction {
|
||
|
AboveUpperLeft = 0,
|
||
|
AboveUpperRight = 1,
|
||
|
AboveLowerRight = 2,
|
||
|
AboveLowerLeft = 3,
|
||
|
BelowUpperLeft = 4,
|
||
|
BelowUpperRight = 5,
|
||
|
BelowLowerRight = 6,
|
||
|
BelowLowerLeft = 7,
|
||
|
Here = 8
|
||
|
}
|
||
|
export {};
|