SurfaceNets

require.mx('mxjs/mesh/surfacenets.js');

Original Surface Nets, modified to generate boundary surfaces between two volumes.

This was loosely based on Mikola Lysenko's Naive SurfaceNets implementation, which should be in this directory as surfacenets-original.js.

Based on: S.F. Gibson, "Constrained Elastic Surface Nets". (1998) MERL Tech Report.

StatusName
Object surfaceNetGridZYX ( DenseGridZYX grid, Number threshold, Number iterations, Number delta )

Generate a surface mesh from an in-memory dense grid. The isosurface will be generated at the level specified by threshold.

Each iteration, nodes will move to the central position of their neighbour nodes. Some reasonable defaults are iterations=50, delta=0.1.

array of vertex positions, and faces, an array of triangle definitions (each of which is an array of 0-based vertex IDs).

Object surfaceNetIJOCSets ( Table IJOCTable, Number begin, Number end, Function readSetID, IJOCBounds bounds, Number iterations, Number delta, Number clampRange )

Generate a surface mesh from an IJOC table using the original Surface Nets algorithm. The IJOC table must be ordered or grouped by I ascending, then J ascending. Nodes will be created in any octet where the value returned by readSetID is different. Faces are generated between any two cells (IJOC indices) for which readSetID is different. The value of readSetID for all indices that are not explicitly covered by an IJOC block is assumed to be zero. Thus this function can be used to generate surfaces between different IJOC groups as well as between IJOC groups and the void.

Note that no IJOC blocks should overlap. If any IJOC blocks overlap, the block that is read later will overwrite any earlier block.

Each iteration, nodes will move to the central position of their neighbour nodes. Some reasonable defaults are iterations=50, delta=0.1.

array of vertex positions; faces, a flat array of triangle definitions (each of which is an array of 1-based vertex IDs); faceSetID1, an array which contains the first set ID for each face; and faceSetID2, an array which contains the second (optional) set ID for each face, or zero if the face is between an IJOC block and the void.


Library Functions

The = Lib.surfaceNetGridZYX ( grid, threshold, iterations, delta )

Generate a surface mesh from an in-memory dense grid. The isosurface will be generated at the level specified by threshold.

Each iteration, nodes will move to the central position of their neighbour nodes. Some reasonable defaults are iterations=50, delta=0.1.

array of vertex positions, and faces, an array of triangle definitions (each of which is an array of 0-based vertex IDs).

Parameters:
  • DenseGridZYX grid - The dense grid to generate the surface for
  • Number threshold - Value at which to generate the surface
  • Number iterations - Number of net relaxations to perform
  • Number delta - Amount to relax the net each iteration
Returns: Object The - mesh, as an object with two members: vertices, an
The = Lib.surfaceNetIJOCSets ( IJOCTable, begin, end, readSetID, bounds, iterations, delta, clampRange )

Generate a surface mesh from an IJOC table using the original Surface Nets algorithm. The IJOC table must be ordered or grouped by I ascending, then J ascending. Nodes will be created in any octet where the value returned by readSetID is different. Faces are generated between any two cells (IJOC indices) for which readSetID is different. The value of readSetID for all indices that are not explicitly covered by an IJOC block is assumed to be zero. Thus this function can be used to generate surfaces between different IJOC groups as well as between IJOC groups and the void.

Note that no IJOC blocks should overlap. If any IJOC blocks overlap, the block that is read later will overwrite any earlier block.

Each iteration, nodes will move to the central position of their neighbour nodes. Some reasonable defaults are iterations=50, delta=0.1.

array of vertex positions; faces, a flat array of triangle definitions (each of which is an array of 1-based vertex IDs); faceSetID1, an array which contains the first set ID for each face; and faceSetID2, an array which contains the second (optional) set ID for each face, or zero if the face is between an IJOC block and the void.

Parameters:
  • Table IJOCTable - IJOC data to generate surface for
  • Number begin - row to begin reading from the table
  • Number end - row to stop reading from the table (exclusive)
  • Function readSetID - function to read a set ID from the table
  • IJOCBounds bounds - boundary to generate surfaces within (see getIJKMinMax in IJOC-to-grid.js)
  • Number iterations - Number of net relaxations to perform
  • Number delta - Amount to relax the net each iteration
  • Number clampRange - clamp vertex movement to within this range of the original position (in IJOC indices) - defaults to 0.5.
Returns: Object The - mesh, as an object with four members: vertices, a flat