Function distance

Returns the distance of point to the nearest point on line.

import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
const d = Lines.distance(line, {x:10,y:10});

If an array of lines is provided, the shortest distance is returned.

  • Parameters

    • line: Line | readonly Line[]

      Line (or array of lines)

    • point: Point

      Point to check against

    Returns number

    Distance