mbostock/d3 — pull request #836 by jasondavies (2012-10-02 10:34:18+00:00)
Title: projection.clipAngle.

Still a couple more things I want to do before this is *perfect*:

1. This includes my fix from the clip-complex branch. However, I'd like to try an alternative fix, which should be theoretically more robust (although I haven't managed to break the current fix yet!)
2. Both cutting and circle clipping fail to cope with the clip edge being completely subsumed by a polygon. This is important for the stereographic projection, for example. Should be straightforward to detect, and there are a few tricks to make it efficient as it's fairly rare for this to happen.

Optimisation ideas (can be done in a future release, potentially):

1. If we know we're visible, it's safe to start drawing immediately, until we see an intersection. At that point, we need to buffer up the remaining points and do the clever clipping stuff. But the common case is that things are either completely visible or not.
2. Optimise special case of clipAngle(90°): shouldn't need to convert to 3D vectors here.
3. Aside from 90°, the circle clipping uses 3D coordinates, so we can reuse the 3D conversion from the rotation here. (That is, if the rotation even converted to 3D in the first place.)