traceLineOfLight(x1, y1, oSource) {
        const m = oSource.metrics;
        const x0 = m.x;
        const y0 = m.y;
        const id = oSource.id;
        const cc = oSource._cc;
        const lb = this._lb;
        const intensity = m.v;
        const r0 = m.r0;
        const r1 = m.r1;
        const g = this._grid;
        const xMax = g.width;
        const yMax = g.height;
        Bresenham.line(x0, y0, x1, y1, (x, y, n) => {
            if (x >= 0 && y >= 0 && x < xMax && y < yMax) {
                if (cc.isMarked(x, y)) {
                    // already computed
                    return true;
                }
                if (lb.isMarked(x, y)) {
                    // light blocked : abort
                    return false;
                }
                const dist = Geometry.distance(x0, y0, x, y);
                let result = 0;
                if (dist <= r0) {
                    // full intensity
                    result = intensity;
                } else if (dist > r1) {
                    // zero intensity
                    result = 0;
                } else {
                    // intensity = linearInterpolation(r0, r1, dist, 1, 0)
                    result = linear(dist, r0, intensity, r1, 0);
                }
                // marker le point
                cc.mark(x, y);
                oSource.lightPixel(x, y);
                this.updatePixel(x, y, result, id);
            }
        });
    }
/**
     * traces a line from the source center to the source edge, stops if the line encounter a light blocking region
     * @param x1 {number} ending point x axis
     * @param y1 {number} ending point y axis
     */
traces a line from the source center to the source edge, stops if the line encounter a light blocking region
@param x1 {number} ending point x axis
@param y1 {number} ending point y axis
traces a line from the source center to the source edge stops if the line encounter a light blocking region @param x1 { number } ending point x axis @param y1 { number } ending point y axis
traceLineOfLight(x1, y1, oSource) {
        const m = oSource.metrics;
        const x0 = m.x;
        const y0 = m.y;
        const id = oSource.id;
        const cc = oSource._cc;
        const lb = this._lb;
        const intensity = m.v;
        const r0 = m.r0;
        const r1 = m.r1;
        const g = this._grid;
        const xMax = g.width;
        const yMax = g.height;
        Bresenham.line(x0, y0, x1, y1, (x, y, n) => {
            if (x >= 0 && y >= 0 && x < xMax && y < yMax) {
                if (cc.isMarked(x, y)) {
                    return true;
                }
                if (lb.isMarked(x, y)) {
                    return false;
                }
                const dist = Geometry.distance(x0, y0, x, y);
                let result = 0;
                if (dist <= r0) {
                    result = intensity;
                } else if (dist > r1) {
                    result = 0;
                } else {
                    result = linear(dist, r0, intensity, r1, 0);
                }
                cc.mark(x, y);
                oSource.lightPixel(x, y);
                this.updatePixel(x, y, result, id);
            }
        });
    }
traceLineOfLight ( x1 , y1 , oSource ) { const m = oSource . metrics ; const x0 = m . x ; const y0 = m . y ; const id = oSource . id ; const cc = oSource . _cc ; const lb = this . _lb ; const intensity = m . v ; const r0 = m . r0 ; const r1 = m . r1 ; const g = this . _grid ; const xMax = g . width ; const yMax = g . height ; Bresenham . line ( x0 , y0 , x1 , y1 , ( x , y , n ) => { if ( x >= 0 && y >= 0 && x < xMax && y < yMax ) { if ( cc . isMarked ( x , y ) ) { return true ; } if ( lb . isMarked ( x , y ) ) { return false ; } const dist = Geometry . distance ( x0 , y0 , x , y ) ; let result = 0 ; if ( dist <= r0 ) { result = intensity ; } else if ( dist > r1 ) { result = 0 ; } else { result = linear ( dist , r0 , intensity , r1 , 0 ) ; } cc . mark ( x , y ) ; oSource . lightPixel ( x , y ) ; this . updatePixel ( x , y , result , id ) ; } } ) ; }
traces a line from the source center to the source edge, stops if the line encounter a light blocking region
 @param x1 {number} ending point x axis
 @param y1 {number} ending point y axis
traces a line from the source center to the source edge stops if the line encounter a light blocking region @param x1 { number } ending point x axis @param y1 { number } ending point y axis
// already computed // light blocked : abort // full intensity // zero intensity // intensity = linearInterpolation(r0, r1, dist, 1, 0) // marker le point