Function fromFlatArray

Returns a line from four numbers [x1,y1,x2,y2].

See toFlatArray to create an array from a line.

import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
const line = Lines.fromFlatArray(...[0, 0, 100, 100]);
// line is {a: { x:0, y:0 }, b: { x: 100, y: 100 } }
  • Parameters

    • array: readonly number[]

      Array in the form [x1,y1,x2,y2]

    Returns Line

    Line