UNPKG

@thi.ng/boids

Version:

n-dimensional boids simulation with modular behavior system

27 lines 1.01 kB
import type { ITimeStep, ReadonlyTimeStep } from "@thi.ng/timestep"; import type { IBoidAccel } from "./api.js"; import type { Boid } from "./boid.js"; /** * Returns a new {@link Flock} instance. * * @param accel * @param boids */ export declare const defFlock: (accel: IBoidAccel, boids?: Boid[]) => Flock; /** * Convenience class for managing a number of boids (can be added * dynamically) and their {@link IBoidAccel} structure. Like {@link Boid} * itself, this class implements the `ITimeStep` interface too and the * {@link ITimeStep.integrate} phase will automatically update the * acceleration structure before integrating the boids. */ export declare class Flock implements ITimeStep { accel: IBoidAccel; boids: Boid[]; constructor(accel: IBoidAccel, boids?: Boid[]); add(boid: Boid): void; remove(boid: Boid): void; integrate(dt: number, ctx: ReadonlyTimeStep): void; interpolate(alpha: number, ctx: ReadonlyTimeStep): void; } //# sourceMappingURL=flock.d.ts.map