This applet uses a scanline algorithm to find all the intersections in a set of arbitrary lines. You need to choose a random seed for the lines and then hit reset which will start up the applet. Then you can hit step to step through the algorithm. The red line is the scanline and the blue circle is the point that caused it to stop.

The source.