nodes/vvvv.nodes.game.js
//unused but keep for later use
unused but keep for later use
unused but keep for later use
function raytraceGrid(x0, x1, y0, y1)
{
    var dx = Math.abs(x1 - x0);
    var dy = Math.abs(y1 - y0);
    var x = Math.floor(x0);
    var y = Math.floor(y0);
    var dt_dx = 1.0 / dx;
    var dt_dy = 1.0 / dy;
    var t = 0;
    var n = 1;
    var x_inc, y_inc;
    var t_next_vertical, t_next_horizontal;
    if (dx == 0)
    {
        x_inc = 0;
        t_next_horizontal = dt_dx; 
    }
    else if (x1 > x0)
    {
        x_inc = 1;
        n += Math.floor(x1) - x;
        t_next_horizontal = (Math.floor(x0) + 1 - x0) * dt_dx;
    }
    else
    {
        x_inc = -1;
        n += x - Math.floor(x1);
        t_next_horizontal = (x0 - Math.floor(x0)) * dt_dx;
    }
    if (dy == 0)
    {
        y_inc = 0;
        t_next_vertical = dt_dy; 
    }
    else if (y1 > y0)
    {
        y_inc = 1;
        n += Math.floor(y1) - y;
        t_next_vertical = (Math.floor(y0) + 1 - y0) * dt_dy;
    }
    else
    {
        y_inc = -1;
        n += y - Math.floor(y1);
        t_next_vertical = (y0 - Math.floor(y0)) * dt_dy;
    }
    var Indices = [];
    var j = 0;
    for (var i = n; i > 0; --i)
    {
        Indices.push(x);
        Indices.push(y);   
        if (t_next_vertical < t_next_horizontal)
        {
            y += y_inc;
            t = t_next_vertical;
            t_next_vertical += dt_dy;
        }
        else
        {
            x += x_inc;
            t = t_next_horizontal;
            t_next_horizontal += dt_dx;
        }
    }
    return Indices;
}
function raytraceGrid ( x0 , x1 , y0 , y1 ) { var dx = Math . abs ( x1 - x0 ) ; var dy = Math . abs ( y1 - y0 ) ; var x = Math . floor ( x0 ) ; var y = Math . floor ( y0 ) ; var dt_dx = 1.0 / dx ; var dt_dy = 1.0 / dy ; var t = 0 ; var n = 1 ; var x_inc , y_inc ; var t_next_vertical , t_next_horizontal ; if ( dx == 0 ) { x_inc = 0 ; t_next_horizontal = dt_dx ; } else if ( x1 > x0 ) { x_inc = 1 ; n += Math . floor ( x1 ) - x ; t_next_horizontal = ( Math . floor ( x0 ) + 1 - x0 ) * dt_dx ; } else { x_inc = - 1 ; n += x - Math . floor ( x1 ) ; t_next_horizontal = ( x0 - Math . floor ( x0 ) ) * dt_dx ; } if ( dy == 0 ) { y_inc = 0 ; t_next_vertical = dt_dy ; } else if ( y1 > y0 ) { y_inc = 1 ; n += Math . floor ( y1 ) - y ; t_next_vertical = ( Math . floor ( y0 ) + 1 - y0 ) * dt_dy ; } else { y_inc = - 1 ; n += y - Math . floor ( y1 ) ; t_next_vertical = ( y0 - Math . floor ( y0 ) ) * dt_dy ; } var Indices = [ ] ; var j = 0 ; for ( var i = n ; i > 0 ; -- i ) { Indices . push ( x ) ; Indices . push ( y ) ; if ( t_next_vertical < t_next_horizontal ) { y += y_inc ; t = t_next_vertical ; t_next_vertical += dt_dy ; } else { x += x_inc ; t = t_next_horizontal ; t_next_horizontal += dt_dx ; } } return Indices ; }
unused but keep for later use
unused but keep for later use
// infinity // infinity //visit(x, y);