rle-core...is a Javascript library for working with narrowband level sets in 3D. It is currently a work in progress, so expect this stuff to change over time. This library contains fundamental primitives and data structures for manipulating these objects.
Features for v0.1:
Planned features:
Via npm:
npm install rle-voxels
And to use it:
var rle = require("rle-voxels");
var box = rle.sample([100, 100, 100], new Function("x",
"return Math.min(Math.min(Math.abs(x[0]-50), Math.abs(x[1]-50)), Math.abs(x[2]-50)) - 30;"
);
var mesh = rle.surface(box);
Internally rle-core represents a volume as a list of runs sorted in colexicographic order. This allows for efficient point membership queries and fast iteration.
rle-core does not support efficient in place updates of volumes (though this may change in the future). The reason for this is that there is no standard balanced binary search tree data structure for Javascript, and none of the implementations that I have seen so far are sufficiently mature, robust and performant for these sorts of data sets.
Here are some resources which explain how to use this library:
(c) 2012-2013 Mikola Lysenko (mikolalysenko@gmail.com). MIT License.