JSPM

isosurface

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 143
  • Score
    100M100P100Q92024F
  • License MIT

3D isosurface polygonizer

Package Exports

  • isosurface

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

Readme

isosurface

Isosurface polygonizer algorithms in JavaScript. For more details, see the following blog posts:

http://0fps.wordpress.com/2012/08/29/what-is-a-solid/

http://0fps.wordpress.com/2012/07/10/smooth-voxel-terrain-part-1/

http://0fps.wordpress.com/2012/07/12/smooth-voxel-terrain-part-2/

Or try out the following live demo:

http://mikolalysenko.github.com/Isosurface/

Usage

First, install the library via npm:

npm install isosurface

require("isosurface").surfaceNets(dims, potential[, bounds])

Extracts an isosurface from potential using surface nets with resolution given by dims.

Params:

  • dims: A 3D vector of integers representing the resolution of the isosurface
  • potential(x,y,z): A scalar valued potential function taking 3 coordinates as arguments returning a scalar.
  • bounds: A pair of 3D vectors [lo, hi] giving bounds on the potential to sample. If not specified, default is [[0,0,0], dims].

Returns: A mesh object with the following members:

  • positions: The coordinates of the vertices of the mesh
  • cells: The faces of the mesh.

require("isosurface").marchingCubes(dims, potential[, bounds])

Same as above, except uses marching cubes instead of surface nets to extract the isosurface.

require("isosurface").marchingTetrahedra(dims, potential[, bounds])

Same as above, except uses marching tetrahedra instead of surface nets to extract the isosurface.

Acknowledgements

(c) 2012-2013 Mikola Lysenko. MIT License