UNPKG

blaze-2d

Version:

A fast and simple WebGL 2 2D game engine written in TypeScript

41 lines (40 loc) 1.23 kB
import Particle from "./particle"; export declare class kdNode { particle: Particle; left: kdNode; right: kdNode; constructor(particle: Particle, left: kdNode, right: kdNode); /** * Determines wether the node is a leaf node or not. * * @returns Wether the node is a leaf node or not */ isLeaf(): boolean; } /** * Represents a kdTree that contains {@link Particle}s. */ export default class kdTree { root: kdNode; /** * Creates a {@link kdTree}. * * @param particles The particles to add to the tree */ constructor(particles: Particle[]); /** * Builds the {@link kdTree}. * * @param particles The particles to add to the tree */ build(particles: Particle[], depth?: number): kdNode; /** * Finds all the neighbours of a particle within the given distance. * * @param particle The particle to find neighbours of * @param dist The maximum distance a neighbour can be from the particle * @param distSqr The maximum distance squared a neighbour can be from the particle */ findNeighbours(particle: Particle, dist: number, distSqr: number): Particle[]; private findNeighboursHelper; }