UNPKG

@dominicstop/utils

Version:

Yet another event emitter written in typescript.

38 lines 1.42 kB
import { AnyBoxedShape, Vector2D } from "../geometry"; import { SomeShapeParticle } from "./SomeShapeParticle"; export type ParticleInit<ParticleShape extends AnyBoxedShape> = { id: string; position: Vector2D; mass: number; initialVelocity?: Vector2D; shape: ParticleShape; }; export declare class Particle<ParticleShape extends AnyBoxedShape> implements SomeShapeParticle<ParticleShape> { id: string; private _position; previousPosition: Vector2D; velocity: Vector2D; acceleration: Vector2D; mass: number; inverseMass: number; shape: ParticleShape; isStatic: boolean; get position(): Vector2D; set position(newValue: Vector2D); constructor(args: ParticleInit<ParticleShape>); clone(): Particle<ParticleShape>; applyForce(force: Vector2D): void; update(deltaTime: number): void; resetAcceleration(): void; getSpeed(): number; getKineticEnergy(): number; setPosition(newPosition: Vector2D): void; setVelocity(newVelocity: Vector2D): void; setMass(newMass: number): void; isCollidingWithOther(other: Particle<ParticleShape>): boolean; computeDistanceToOther(other: Particle<ParticleShape>): number; computeOverlapVectorWith(other: Particle<ParticleShape>): Vector2D; checkIsAtRest(): boolean; isEdgeToEdgeWithOther(other: Particle<ParticleShape>): boolean; } //# sourceMappingURL=Particle.d.ts.map