Finds the entry plane of the first octant that a ray travels through.

Determining the first octant requires knowing which of the t0s is the
largest. The tms of the other axes must also be compared against that
largest t0.

@private
@param {Number} tx0 - Ray projection parameter.
@param {Number} ty0 - Ray projection parameter.
@param {Number} tz0 - Ray projection parameter.
@param {Number} txm - Ray projection parameter mean.
@param {Number} tym - Ray projection parameter mean.
@param {Number} tzm - Ray projection parameter mean.
@return {Number} The index of the first octant that the ray travels through.
function findEntryOctant(tx0, ty0, tz0, txm, tym, tzm) {

	let entry = 0;

	// Find the entry plane.
	if(tx0 > ty0 && tx0 > tz0) {

		// YZ-plane.
		if(tym < tx0) {

			entry |= 2;

		}

		if(tzm < tx0) {

			entry |= 1;

		}

	} else if(ty0 > tz0) {

		// XZ-plane.
		if(txm < ty0) {

			entry |= 4;

		}

		if(tzm < ty0) {

			entry |= 1;

		}

	} else {

		// XY-plane.
		if(txm < tz0) {

			entry |= 4;

		}

		if(tym < tz0) {

			entry |= 2;

		}

	}

	return entry;

}