Skip to content

Commit

Permalink
due to numeric instability, Chrome was choosing the wrong orientation…
Browse files Browse the repository at this point in the history
… at the north pole, effectively putting the cubic map upside down.

closes #75
  • Loading branch information
Fil committed Nov 10, 2024
1 parent b27f6c9 commit 7352226
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/cubic.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Cubic map
*
* Implemented for D3.js by Enrico Spinielli (2017) and Philippe Rivière (2017, 2018)
* Implemented for D3.js by Enrico Spinielli (2017) and Philippe Rivière (2017—2024)
*
*/
import voronoi from "./polyhedral/voronoi.js";
Expand Down Expand Up @@ -38,7 +38,6 @@ export default function() {
return voronoi()
.polygons(polygons)
.parents(parents)
.angle(0)
.scale(96.8737)
.center([135, -45])
.rotate([120,0]);
Expand Down
5 changes: 4 additions & 1 deletion src/polyhedral/voronoi.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import polyhedral from "./index.js";
const faceProjection0 = (face) => gnomonic()
.scale(1)
.translate([0, 0])
.rotate([-face.site[0], -face.site[1]]);
.rotate([
Math.abs(face.site[1]) > 89.99999999 ? 0 : -face.site[0],
-face.site[1]
]);

export default function(
parents = [],
Expand Down

0 comments on commit 7352226

Please sign in to comment.