
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
spatial-grid
Advanced tools
Spatial queries on simplicial complexes in arbitrary dimensions.
First, install via npm:
npm install spatial-grid
Then you can create grids and query them as follows:
var mesh = require("bunny");
var grid = require("spatial-grid")(mesh, 0.1);
console.log(grid.closestCells([1.0, 0.0, 0.0]));
Which returns the following data:
{ points: [ [ 1.0520095436290573, 0.2639268057343442, 0.10221864065360134 ] ],
cells: [ 3507 ],
distance: 0.2877690079051383 }
The code should work for two dimensional meshes, tetrahedral volume, and other higher dimensional structures.
require("spatial-grid")(mesh, tolerance)Creates a spatial grid over the simplicial complex determined by [positions, cells] with cell size = tolerance.
mesh is an object containing the following fields
cells (or optionally faces): an array of cells, represented as indicespositions: An array of position vectorstolerance: The resolution of the cell complexReturns a spatial grid for the cell complex.
grid.closestCells(x)Returns information about the closest cell to the point x within the specified tolerance.
x is a pointReturns: If no cell is within tolerance, returns null. Otherwise, returns an object with the following parameters:
cells: An array of cells of approximately equal distance to x (within a tolerance of +/-1e-6 )points: An array of points closest to xdistance: The distance to the surface from xgrid.neighborhood(x, radius)Returns all of the cells in the complex which are within radius distance of the point x.
Currently the library is built on top of the FORTRAN code quadprog, which solves the simplex-closest point problem. If this library gets popular enough, I may eventually add faster routines for low dimensional queries. For high dimensions, the search routines used in this library become exponentially less efficient. However the performance should be "good enough" for d <= 3, and it is probably usable up to d<=5.
(c) 2013 Mikola Lysenko. BSD
FAQs
Computes closest points to meshes and polygons
The npm package spatial-grid receives a total of 1 weekly downloads. As such, spatial-grid popularity was classified as not popular.
We found that spatial-grid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.