Round a direction vector to an 8-way compass
Two more optimizations:<p>- Use <i>else if</i> to avoid uncessary condition checking.<p>- Only check for <i>xneg</i> &#x2F; <i>yneg</i> if <i>outx</i> &#x2F; <i>outy</i> are non-zero.