🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

spatial-grid

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spatial-grid

Computes closest points to meshes and polygons

Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
9
800%
Maintainers
1
Weekly downloads
 
Created
Source

spatial-grid

Spatial queries on simplicial complexes.

Usage and Installation

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("sptial-grid")(mesh, 0.1);
var cells = grid.closestCells([1.0, 0.0, 0.0]);

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 indices
    • positions: An array of position vectors
  • tolerance: The resolution of the cell complex

Returns 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 point

Returns: 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
  • points: An array of points closest to x
  • distance: The distance to the surface from x

Credits

(c) 2013 Mikola Lysenko. BSD

Keywords

3d

FAQs

Package last updated on 10 Feb 2013

Did you know?

Socket

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.

Install

Related posts