Skip to content

Commit cf66ccc

Browse files
committed
Fix failing tests.
d3.geom.voronoi now returns clockwise polygons instead of counter-clockwise. This is consistent with d3.geo’s use of a clockwise winding order to denote the inside of polygons on the sphere (and subsequently when projected to 2D).
1 parent ee2476b commit cf66ccc

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

test/geom/voronoi-test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ suite.addBatch({
5858
},
5959
"returns two cells with the expected geometry": function(cells) {
6060
assert.inDelta(cells, [
61-
[[-178046.7857142857, 1e6], [179096.07142857145, -1e6], [-1e6, 1e6], [1e6, 1e6]],
62-
[[-178046.7857142857, 1e6], [179096.07142857145, -1e6], [-1e6, -1e6], [1e6, -1e6]]
61+
[[-1e6, 1e6], [-1e6, -1e6], [179096.07142857145, -1e6], [-178046.7857142857, 1e6]],
62+
[[1e6, -1e6], [1e6, 1e6], [-178046.7857142857, 1e6], [179096.07142857145, -1e6]]
6363
], 1e-6);
6464
},
6565
"the returned cells are open polygons": function(cells) {
@@ -100,9 +100,9 @@ suite.addBatch({
100100
},
101101
"for three points": function(v) {
102102
assert.deepEqual(v.links([[200, 200], [500, 250], [760, 300]]), [
103-
{source: [200, 200], target: [760, 300]},
103+
{source: [200, 200], target: [500, 250]},
104104
{source: [500, 250], target: [760, 300]},
105-
{source: [200, 200], target: [500, 250]}
105+
{source: [760, 300], target: [200, 200]}
106106
]);
107107
}
108108
},
@@ -133,8 +133,8 @@ suite.addBatch({
133133
},
134134
"returns two cells with the expected geometry": function(cells) {
135135
assert.inDelta(cells, [
136-
[[480, 1e6], [480, -1e6], [-1e6, -1e6], [-1e6, 1e6]],
137-
[[480, -1e6], [480, 1e6], [1e6, -1e6], [1e6, 1e6]]
136+
[[-1e6, 1e6], [-1e6, -1e6], [480, -1e6], [480, 1e6]],
137+
[[1e6, -1e6], [1e6, 1e6], [480, 1e6], [480, -1e6]]
138138
], 1e-6);
139139
}
140140
},
@@ -149,9 +149,9 @@ suite.addBatch({
149149
},
150150
"for three points": function(v) {
151151
assert.deepEqual(v.links([{x: 200, y: 200}, {x: 500, y: 250}, {x: 760, y: 300}]), [
152-
{source: {x: 200, y: 200}, target: {x: 760, y: 300}},
152+
{source: {x: 200, y: 200}, target: {x: 500, y: 250}},
153153
{source: {x: 500, y: 250}, target: {x: 760, y: 300}},
154-
{source: {x: 200, y: 200}, target: {x: 500, y: 250}}
154+
{source: {x: 760, y: 300}, target: {x: 200, y: 200}}
155155
]);
156156
}
157157
}
@@ -170,7 +170,7 @@ suite.addBatch({
170170
},
171171
"returns two cells with the expected geometry": function(cells) {
172172
assert.inDelta(cells, [
173-
[[435.35714285715324, 500], [524.6428571428696, 0], [0, 0], [0, 500]],
173+
[[0, 500], [0, 0], [524.6428571428696, 0], [435.35714285715324, 500]],
174174
[[960, 0], [960, 500], [435.35714285715324, 500], [524.6428571428696, 0]]
175175
], 1e-6);
176176
},

0 commit comments

Comments
 (0)