assassin-bug/framework/physics/octtree.d.ts

39 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-11-26 01:22:02 +00:00
import { PhysicsObject } from "./object";
import { Vec3 } from "./vec3";
export declare class Octtree {
private dimensions;
private maxObjects;
private maxLevels;
root: OctTreeNode;
constructor(dimensions: Vec3, maxObjects?: number, maxLevels?: number);
insert(obj: PhysicsObject): void;
find(position: Vec3, dimensions: Vec3): PhysicsObject[];
}
export declare class OctTreeNode {
private position;
private dimensions;
private maxLevels;
private maxObjects;
objects: PhysicsObject[];
nodes: OctTreeNode[];
constructor(position: Vec3, dimensions: Vec3, maxLevels: number, maxObjects: number);
insert(obj: PhysicsObject): void;
find(position: Vec3, dimensions: Vec3): PhysicsObject[];
split(): void;
private distributeObjectsToNodes;
getIndex(x: number, y: number, z: number): Direction;
getIndeciesForRect(position: Vec3, dimensions: Vec3): Set<Direction>;
}
declare enum Direction {
AboveUpperLeft = 0,
AboveUpperRight = 1,
AboveLowerRight = 2,
AboveLowerLeft = 3,
BelowUpperLeft = 4,
BelowUpperRight = 5,
BelowLowerRight = 6,
BelowLowerLeft = 7,
Here = 8
}
export {};