import { AgentSet, CellGrid } from '../structures'; import Vector2 from '../numbers/Vector2'; import Agent, { type AgentConstructor } from './Agent'; import Cell from './Cell'; export interface ParticleConstructor extends AgentConstructor { initialVelocity: [number, number]; mass?: number; } export default abstract class Particle extends Agent { acceleration: Vector2; velocity: Vector2; mass: number; constructor(opts: ParticleConstructor); get kineticEnergy(): number; get momentum(): Vector2; /** * Applies an acceleration to the particle proportionate to the net gravitational attraction of all other particles in the given set. */ resolveGravitation(world: CellGrid, particles: AgentSet): void; resolveCollisions(world: CellGrid, particles: AgentSet, options?: { particle?: boolean; }): void; private resolveParticleCollision; private resolveBoundaryCollision; private resolveGravitationPair; }