mbostock/d3 — pull request #837 by jasondavies (2012-10-03 21:28:50+00:00)
Title: Add extra ring if polygon "surrounds" clip circle.

For example, when using the stereographic projection with a large clip circle of 179°, a polygon surrounding the removed region of 1° radius effectively becomes inverted, such that its vertices define a hole within the large clip circle of 179°. So in this case, we need to insert an additional ring around the clip circle, going in the opposite direction to the inverted polygon, so that the default non-zero winding rule for fill (in both canvas and SVG) fills only the area between the clip edge and the polygon boundary.

The winding number calculation can be optimised using the 3D coordinates directly from the rotation step, rather than performing additional trig. calculations. (Likewise, other clipping operations can also work on 3D coordinates directly.)

Here is North America around the boundary of a stereographic projection:

![](http://www.jasondavies.com/tmp/stereo-clip.png)