UNPKG

698 BJavaScriptView Raw
1/*
2 * Cubic map
3 *
4 * Implemented for D3.js by Enrico Spinielli (2017) and Philippe Rivière (2017, 2018)
5 *
6 */
7import voronoi from "./polyhedral/voronoi.js";
8import { default as cube } from "./polyhedral/cube.js";
9
10export default function() {
11 var polygons = {
12 type: "FeatureCollection",
13 features: cube.map(function(face) {
14 face = face.slice();
15 face.push(face[0]);
16 return {
17 geometry: {
18 type: "Polygon",
19 coordinates: [face]
20 }
21 };
22 })
23 };
24
25 var parents = [-1, 0, 1, 5, 3, 2];
26
27 return voronoi()
28 .polygons(polygons)
29 .parents(parents)
30 .angle(0)
31 .scale(96.8737)
32 .center([135, -45])
33 .rotate([120,0]);
34}
35