Function pointsOf

  • Yields every integer point along line.

    Parameters

    Returns Generator<Point>

    import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
    const l = { a: {x: 0, y: 0}, b: {x: 100, y: 100} };
    for (const p of Lines.pointsOf(l)) {
    // Do something with point `p`...
    }

    Some precision is lost as start and end point is also returned as an integer.

    Uses Bresenham's line algorithm