How to use delaunay-find - 2 common examples

To help you get started, we’ve selected a few delaunay-find 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 FormidableLabs / victory / packages / victory-voronoi-container / src / voronoi-helpers.js View on Github external
getVoronoiPoints(props, mousePosition) {
    const datasets = this.getDatasets(props);
    const scaledData = datasets.map((d) => {
      const { x, y } = Helpers.scalePoint(props, d);
      return [x, y];
    });
    const delaunay = Delaunay.from(scaledData);
    const index = delaunay.find(mousePosition.x, mousePosition.y, props.vIndex);
    const withinRadius = this.withinRadius(scaledData[index], mousePosition, props.radius);
    const points = withinRadius ? this.findPoints(datasets, datasets[index]) : [];
    return { points, index };
  },
github FormidableLabs / victory / packages / victory-voronoi-container / src / voronoi-helpers.js View on Github external
getVoronoiPoints(props, mousePosition) {
    const datasets = this.getDatasets(props);
    const scaledData = datasets.map((d) => {
      const { x, y } = Helpers.scalePoint(props, d);
      return [x, y];
    });
    const delaunay = Delaunay.from(scaledData);
    const index = delaunay.find(mousePosition.x, mousePosition.y);
    const withinRadius = this.withinRadius(scaledData[index], mousePosition, props.radius);
    const points = withinRadius ? this.findPoints(datasets, datasets[index]) : [];
    return { points, index };
  },

delaunay-find

Finds the nearest point based on a delaunay diagram

ISC
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular delaunay-find functions

Similar packages