So, the counterclockwise function tells whether points A, B, and C are in counterclockwise order. IE, if you graphed the XY coordinates of times on a lock, the points found at 11, 5, and 3 would be counterclockwise, while the points found at 11, 3, and 5 would not.
Based off the ordering of points relative to eachother, you can tell if lines intersect.
To be honest, I found this algorithm on a mailing list posting or something years ago, and haven't thought about it too much since (aside from the fact that it works). It kind of hurts my brain a little.