Package Exports
- spatial-grid
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spatial-grid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
spatial-grid
Spatial queries on simplicial complexes
Usage and Installation
First, install via npm:
npm install spatial-gridThen you can create grids and query them as follows:
var mesh = require("bunny");
var grid = require("sptial-grid")require("spatial-grid")(mesh, tolerance)
Creates a spatial grid over the simplicial complex determined by [positions, cells] with cell size = tolerance.
meshis an object containing the following fieldscells(or optionallyfaces): an array of cells, represented as indicespositions: An array of position vectors
tolerance: The resolution of the cell complex
Returns a spatial grid for the cell complex.
grid.closestCell(x)
Returns information about the closest cell to the point x within the specified tolerance.
xis a point
Returns: If no cell is within tolerance, returns null. Otherwise, returns an object with the following parameters:
cell: The index of the cell within the complexpoint: The closest point toxsolution: The barycentric coordinates of the closest point toxvalue: The distance to the surface fromx- ... a bunch of random crap from the quadratic programming solver that you should ignore.
grid.signedDistance(x)
If mesh is orientable, returns the signed distance to the point x assuming x is within a specified distance to the boundary. Otherwise returns NaN.
Credits
(c) 2013 Mikola Lysenko. BSD