UNPKG

@thi.ng/geom-closest-point

Version:

2D / 3D closest point / proximity helpers

9 lines (8 loc) 288 B
import { add } from "@thi.ng/vectors/add"; import { direction } from "@thi.ng/vectors/direction"; const closestPointCircle = (p, c, r, out = []) => add(out, c, direction(out, c, p, r)); const closestPointSphere = closestPointCircle; export { closestPointCircle, closestPointSphere };