aboutsummaryrefslogtreecommitdiff
path: root/static/src/vector.ts
blob: e7be9fa3884c6b9b39fd79d1b140eef39a01f1b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
export class Vec2 {
  constructor(
    private readonly x: number,
    private readonly y: number,
  ) {}

  public distance_to(that: Vec2): number {
    return Math.sqrt((this.x - that.x) ** 2 + (this.y - that.y) ** 2);
  }
}