length

atlas.length · #cqzvrgmv · term · runs anywhere

How far a route goes, visiting its points in order.

length([{ x: 0, y: 0 }, { x: 3, y: 4 }, { x: 3, y: 0 }])
⧩ 9
import { distance } from "#codebase/geo";
import type { Point } from "#codebase/geo";

export const length = (route: Point[]): number =>
  route.slice(1).reduce((n, p, i) => n + distance(route[i]!, p), 0)

uses

used by