/** A coord on a grid whose origin is in the top left. */ export default class Coord { private readonly _x: number; private readonly _y: number; constructor(x: number, y: number) { this._x = x; this._y = y; } get x(): number { return this._x; } get y(): number { return this._y; } /** Get the squared distance of this point from the origin. */ squaredDistanceFromOrigin(): number { return this._x * this._x + this._y * this._y; } }