Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/cell-range
Specify a range of vectors and get a list of all the points between them
https://github.com/hughsk/cell-range
Last synced: 8 days ago
JSON representation
Specify a range of vectors and get a list of all the points between them
- Host: GitHub
- URL: https://github.com/hughsk/cell-range
- Owner: hughsk
- License: other
- Created: 2013-07-07T09:23:50.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-07T09:24:04.000Z (over 11 years ago)
- Last Synced: 2024-10-17T16:40:10.023Z (22 days ago)
- Language: JavaScript
- Size: 97.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
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](http://github.com/hughsk/moore).## Installation ##
``` bash
npm install cell-range
```## Usage ##
### `require('cell-range')(hi, lo)` ###
Takes two position arrays, returning an array of points between:
``` javascript
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]
```