How to use d3-geo-voronoi - 1 common examples

To help you get started, we’ve selected a few d3-geo-voronoi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eranimo / terranova / src / interface / globe / GlobeView.tsx View on Github external
const points = 1500;
    const fibonacciSpherePoints = getFibonacciSpherePoints(points, radius);

    for (var i = 0; i < fibonacciSpherePoints.length; i++) {
      const point = fibonacciSpherePoints[i];
      const geometry = new THREE.SphereGeometry(0.02);
      const material = new THREE.MeshBasicMaterial({ color: 0xFF0000 });
      const sphere = new THREE.Mesh(geometry, material);
      sphere.position.x = point.x;
      sphere.position.y = point.y;
      sphere.position.z = point.z;
      this.scene.add(sphere);
    }

    const pointsLatLong = fibonacciSpherePoints.map(({ x, y, z }) => Coordinate.cart([x, y, z]).spherical());
    const voronoi = geoDelaunay(pointsLatLong);
    console.log(voronoi);

    const landMaterial = new THREE.MeshBasicMaterial({ color: 0x7cfc00, transparent: true });
    const oceanMaterial = new THREE.MeshBasicMaterial({ color: 0x0f2342, transparent: true });

    const materials = [landMaterial, oceanMaterial];

    // const tileMeshes: { mesh: THREE.Mesh, materialIndex: number }[] = [];
    // const totalGeometry = new THREE.Geometry();


    const centerGeometry = new THREE.BufferGeometry();
    const centerMaterial = new THREE.PointsMaterial({ size: .05, color: 0x0000FF });
    const centerPositions = [];
    for (const center of voronoi.centers) {
      const centerPoint = Coordinate.spherical([radius, center[0], center[1]]).cartesian();

d3-geo-voronoi

Spherical Voronoi Diagram and Delaunay Triangulation

ISC
Latest version published 6 months ago

Package Health Score

71 / 100
Full package analysis

Popular d3-geo-voronoi functions