examples/3d/js/map.js
function(rise, run, x, y, inverted) {
    if (run === 0) {
      return {len2: Infinity};
    }

    var dx = run > 0 ? Math.floor(x + 1) - x : Math.ceil(x - 1) - x;
    var dy = dx * (rise / run);

    return {
      x: inverted ? y + dy : x + dx,
      y: inverted ? x + dx : y + dy,
      len2: dx * dx + dy * dy
    };
  }
function(rise, run, x, y, inverted) {
    if (run === 0) {
      return {len2: Infinity};
    }

    var dx = run > 0 ? Math.floor(x + 1) - x : Math.ceil(x - 1) - x;
    var dy = dx * (rise / run);

    return {
      x: inverted ? y + dy : x + dx,
      y: inverted ? x + dx : y + dy,
      len2: dx * dx + dy * dy
    };
  }
function ( rise , run , x , y , inverted ) { if ( run === 0 ) { return { len2 : Infinity } ; } var dx = run > 0 ? Math . floor ( x + 1 ) - x : Math . ceil ( x - 1 ) - x ; var dy = dx * ( rise / run ) ; return { x : inverted ? y + dy : x + dx , y : inverted ? x + dx : y + dy , len2 : dx * dx + dy * dy } ; }
Processes each step along the ray.
@param  {Number} rise     Slope of line: sine of the cast angle.
@param  {Number} run      Slope of line: cosine of the cast angle.
@param  {Number} x        Origin x-position.
@param  {Number} y        Origin y-position.
@param  {Boolean} inverted
Processes each step along the ray .