Граф коммитов

2 Коммитов

Автор SHA1 Сообщение Дата
Jason Davies f9148ed4f4 Rearrange polygon tests.
This arranges them first by the type of polygon we're testing, then the
operations.  I've added tests for clockwise polygons too, for good
measure.
2011-10-08 18:19:01 +01:00
Jason Davies 3740741441 Add tests for d3.geom.polygon and fix centroid bug.
d3.geom.polygon(…).area() assumes screen pixel coordinates with (0, 0)
at the top left, and y increasing going downwards.  This results in a
positive area for counterclockwise coordinates.  Howver, the default
centroid calculation was assuming "usual" Cartesian coordinates with y
increasing going upwards, hence the centroid coordinates were
incorrectly multiplied by -1.

This fix won't affect d3.geo.path(…).centroid() as it passes a constant
to d3.geom.centroid.
2011-10-08 18:01:53 +01:00