Skip to content

Commit ae5d3fb

Browse files
committed
Oops, invert area for clockwise polygons.
1 parent a502859 commit ae5d3fb

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

d3.geom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ d3.geom.polygon = function(coordinates) {
1111
a += coordinates[i - 1][0] * coordinates[i][1];
1212
b += coordinates[i - 1][1] * coordinates[i][0];
1313
}
14-
return (a - b) * .5;
14+
return (b - a) * .5;
1515
};
1616

1717
// The Sutherland-Hodgman clipping algorithm.

d3.geom.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geom/polygon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ d3.geom.polygon = function(coordinates) {
1010
a += coordinates[i - 1][0] * coordinates[i][1];
1111
b += coordinates[i - 1][1] * coordinates[i][0];
1212
}
13-
return (a - b) * .5;
13+
return (b - a) * .5;
1414
};
1515

1616
// The Sutherland-Hodgman clipping algorithm.

0 commit comments

Comments
 (0)