"Rays linesweep.py" demonstrates ray casting using the line-sweep algorithm. Rays are cast from the mouse point and can be seen by pressing the left mouse button. It also includes a vertex detection algorithm which massively boosts resolution without a big performance hit like increasing the base ray count, you can toggle this by clicking the spacebar.
Example 1, this has 45 rays with vertex detection on.
Example 2, this has 45 rays with vertex detection off.
Example 3, this has 45 rays with vertex detection off and visible rays. (red = missed ray, green = collided ray, blue = new vertex detection ray)
Example 4, this had 45 rays with vertex detection and visible rays. (red = missed ray, green = collided ray, blue = new vertex detection ray)