/* js/src/dn /* js/src/dn/rayshoot.js 
Computes the hyperplane in `Ax = b` closest to `z` with respect to the
direction `r`. Complexity is O(nd).

@param {dimension} d space dimension
@param {count} m the number of hyperplanes
@param {matrix} A an m x d matrix
@param {vector} b a vector of length d
@param {vertex} z the point to shoot from
@param {direction} r the direction to shoot in
function rayshoot(d, m, A, b, z, r) {

			var i = 0;
			var j = m;
			var w = undefined;

			while (true) {

				if (i >= j) return j;

				var h = A[i];

				w = (b[i] - vdot(d, h, z)) / vdot(d, h, r);

				if (w >= 0) break;

				++i;
			}

			var k = i;

			while (true) {

				++i;

				if (i >= j) return k;

				var h = A[i];

				var l = (b[i] - vdot(d, h, z)) / vdot(d, h, r);

				if (l < 0 || l >= w) continue;

				k = i;
				w = l;
			}
		}