Function perpendicularPoint

Returns a point perpendicular to line at a specified distance. Use negative distances for the other side of line.

import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
// Project a point 100 units away from line, at its midpoint.
const pt = Lines.perpendicularPoint(line, 100, 0.5);
  • Parameters

    • line: Line

      Line

    • distance: number

      Distance from line. Use negatives to flip side

    • amount: number = 0

      Relative place on line to project point from. 0 projects from A, 0.5 from the middle, 1 from B.

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number