JSPM

cell-range

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q43546F
  • License MIT

Specify a range of vectors and get a list of all the points between them

Package Exports

  • cell-range

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 (cell-range) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cell-range

Takes a "hi" and "lo" pair of vectors and returns all of the possible (integer) vector values between them - handling an arbitrary number of dimensions. It's essentially a more general purpose version of moore.

Installation

npm install cell-range

Usage

require('cell-range')(hi, lo)

Takes two position arrays, returning an array of points between:

var range = require('cell-range')
var cells = range(
  [-1, -1, -1],
  [+1, +1, +1]
)

for (var i = 0; i < cells.length; i += 1) {
  console.log(cells[i])
}

// [-1,-1]
// [-1, 0]
// [-1, 1]
// [ 0,-1]
// [ 0, 0]
// [ 0, 1]
// [ 1,-1]
// [ 1, 0]
// [ 1, 1]