Function normaliseByRect

Normalises start and end points by given width and height. Useful for converting an absolutely-defined line to a relative one.

import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'

// Line 1,1 -> 10,10
const l = Lines.fromNumbers(1,1,10,10);
const ll = Lines.normaliseByRect(l, 10, 10);
// Yields: 0.1,0.1 -> 1,1
  • Parameters

    • line: Line
    • width: number
    • height: number

    Returns Line