Catalog npm
Back to packageRELEASE DETAILS

0.0.2

npm

3d-adjacency

find clusters of adjacent cells from a 3d array.

Published31 May 2016
Direct dependencies9
Transitive dependenciesNot calculated

README

Current package documentation

3d-adjacency

Codeship Status for cdaringe/3d-adjacency Coverage Status

find "clusters" of adjacent cells from a 3d array. the array does not need to be cubic, but it does need to be a rectangular prism.

example

suppose you had a three dimensional array, full of 0s and 1s. 0s are white, and 1s are green. graphically, it may look like:

what you desire is the sets of connected green cells. graphically, it may look like:

well, that's exactly what this module provides! yahoo!

const adj3d = require('3d-adjacency')
const exampleCube = [ // as shown above
	[
	  [1, 0, 1], [0, 0, 0], [1, 0, 1],
	],
	[
	  [1, 0, 1], [0, 0, 0], [1, 0, 1],
	],
	[
	  [1, 0, 1], [0, 0, 0], [1, 0, 2],
	],
]
const groups = adj3d.find(exampleCube)
// ==>
/*
[ // four groups of green blocks
  [
    { x: 0, y: 0, z: 0, value: 1 },
    { x: 1, y: 0, z: 0, value: 1 },
    { x: 2, y: 0, z: 0, value: 1 }
  ],
  [
    { x: 0, y: 0, z: 2, value: 1 },
    { x: 1, y: 0, z: 2, value: 1 },
    { x: 2, y: 0, z: 2, value: 1 }
  ],
  [
    { x: 0, y: 2, z: 0, value: 1 },
    { x: 1, y: 2, z: 0, value: 1 },
    { x: 2, y: 2, z: 0, value: 1 }
  ],
  [
    { x: 0, y: 2, z: 2, value: 1 },
    { x: 1, y: 2, z: 2, value: 1 },
    { x: 2, y: 2, z: 2, value: 2 }
  ]
]
*/

"Hey, why is output not matching the same form as the input?"

Valid question. Specifically, the output is a set of objects that are coordinates+values. the input is the actual data. Although one might expect the output to be something like [ [0, 1, 2] ], where 0, 1, 2 are coordinates, the input was not coordinate sets to begin with.

install

npm install --save 3d-adjacency

usage

See example above and the offcial API docs

changelog

  • 0.0.3 handle much larger arrays. remove recursive calls to keep stack down

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 9

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
coveralls
Environment
{
  "local_name": "coveralls",
  "alias": false,
  "peer_metadata": null
}
^2.11.9development
gh-pages
Environment
{
  "local_name": "gh-pages",
  "alias": false,
  "peer_metadata": null
}
^0.11.0development
jsdoc
Environment
{
  "local_name": "jsdoc",
  "alias": false,
  "peer_metadata": null
}
^3.4.0development
minami
Environment
{
  "local_name": "minami",
  "alias": false,
  "peer_metadata": null
}
^1.1.1development
nyc
Environment
{
  "local_name": "nyc",
  "alias": false,
  "peer_metadata": null
}
^6.4.4development
shizam
Environment
{
  "local_name": "shizam",
  "alias": false,
  "peer_metadata": null
}
0.0.5development
standard
Environment
{
  "local_name": "standard",
  "alias": false,
  "peer_metadata": null
}
^7.1.1development
standard-format
Environment
{
  "local_name": "standard-format",
  "alias": false,
  "peer_metadata": null
}
^2.2.1development
tape
Environment
{
  "local_name": "tape",
  "alias": false,
  "peer_metadata": null
}
^4.5.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "bca026a5609bf4e2c6f90e811fad91d6b4c3497f",
  "tarball": "https://registry.npmjs.org/3d-adjacency/-/3d-adjacency-0.0.2.tgz",
  "integrity": "sha512-z9eAXZXDwRr2jUQ9spF46InxRj0xPbDEOLOzNMMAiVYEYIbCCzLsmQU+kwLrFcIMUd9nZQ0bkT7o42H3ptuicg==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIAE4hVK91ebCxncFJh3NdQNFlQOHJgarR877w5Wnf/qMAiEAwuDwg6S27S2WZO27DfL3hnM3BUK+AmouZL0mGUT1ex8="
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:32 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:574004c7fec8b2794cdd98a4ccd8bfbf92fd0ce5a997b4d6bb5ef51bae5384b1

Other collected versions

0.0.129 MayView all collected versions →