Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 361 Bytes

README.md

File metadata and controls

19 lines (14 loc) · 361 Bytes

twig

Twig is a tiny library used primarily for finding the mid-point of a path or polyline on a 2D plane.

Rough usage:

import { findMidpoint } from "/path/to/path";

const path = [
    { x: 0, y: 0 },
    { x: 10, y: 10 },
    { x: 20, y: 20 },
    { x: 30, y: 30 }
];

const midpoint = findMidpoint(path);
// midpoint = { x: 15, y: 15 }