Modified the LoS algorithm to correctly handle all slopes.