Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including three-simplicial-complex with all npm packages installed. Try it out:

var threeSimplicialComplex = require("three-simplicial-complex")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

three-simplicial-complex v69.0.6

render simplicial complexes with ThreeJS

three-simplicial-complex

stable

img

Creates a THREE.Geometry from a 3D simplicial complex. See demo for an example.

var Complex = require('three-simplicial-complex')(THREE)

var mesh = {
    positions: [ [25,25,25], [15,15,25], [50,50,25], [15,15,15], ... ],
    cells: [ [0,1,2], [1,3,2], ...]
}

var complex = Complex(mesh)
complex.position.x = 2
scene.add(complex)

This is useful for inter-op with modules like icosphere, bunny, stanford-dragon, mesh-combine, extrude-polyline, teapot, triangulate-contours, etc.

Usage

NPM

geo = Complex([mesh])

Creates a new THREE.Geometry with the given complex (optional), where mesh contains { positions, cells }.

geo.update(mesh)

Updates the THREE.Geometry with the new simplicial complex.

Versioning

This uses an unusual versioning system to better support ThreeJS's (lack of) versioning. The major version of this repo will line up with ThreeJS releases (69.0.0 => r69). The minor will be reserved for any new features, and patch for bug fixes and documentation/readme updates. In some rare cases, a minor feature may introduce a breaking change; so it's generally safest to use tilde or save-exact for this module.

License

MIT, see LICENSE.md for details.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free