tmpvar/polygon.clip.js — pull request #4 by cbupp (2014-02-15 20:12:28+00:00)
Title: Fixing the algorithm

Adding a failing unit tests, and then making the code work. I tried to make the changes minimal.

2 main improvements:
- Phase 2 was using the wrong polygons for the "contains point" test (The contains point test also was broken)
- Phase 3 was using the wrong direction (trying to correct for phase 2)