mbostock/topojson — pull request #4 by jasondavies (2012-11-30 21:27:22+00:00)
Title: Add tests and polygon area checks.

This uses a speedy spherical polygon area algorithm from NASA JPL:

http://trs-new.jpl.nasa.gov/dspace/bitstream/2014/40409/1/07-03.pdf

Note that we don't use their final form since they make simplifications
that drop the clockwise/anticlockwise distinction in some cases!

We also completely drop quantised polygons that have an area smaller
than an estimate of the smallest area quantum. This is because the
pesky polygons can turn into figure-of-eights, with a really small area
that can flip either side of zero if further floating point calculations
are performed. We should probably perform a similar sanity check in D3
if possible, although we don't have a quantum area there to compare
against.

The tests brought to light a couple of issues with handling of
LineStrings and Polygons directly, as opposed to wrapped in Geometry or
Feature objects.