GridTools

require.mx('mxjs/mesh/grid-tools.js');

Functions for using grid data (e.g. to convert grid data from a table into a representation that can be used with isosurface generators such as SurfaceNets).

StatusName
DenseGridZYX createDenseGridZYX ( Number spacing, Number begin, Number end, Function read_point, Function read_value, Number borderCells )

Create a dense grid representation of a series of values on a grid. This can be used with other functions that operate on a dense grid (such as the SurfaceNets isosurface generators). This function generates the dense grid in ZYX order (the order of the dense grid must match the order required by the consuming function, if any).

Object determineMinMaxPoints ( Number ↓begin, Number ↓end, Function ↓read_point )

Determine minimum, maximum points from a series of points in a table. These points define an AABB that contains all of the points in the series (some of which may lie on the boundaries of the AABB).


Library Functions

denseGrid = Lib.createDenseGridZYX ( spacing, begin, end, read_point, read_value, borderCells )

Create a dense grid representation of a series of values on a grid. This can be used with other functions that operate on a dense grid (such as the SurfaceNets isosurface generators). This function generates the dense grid in ZYX order (the order of the dense grid must match the order required by the consuming function, if any).

Parameters:
  • Number spacing - the space between grid points (note that all 3 dimensions must have the same spacing)
  • Number begin - table row to begin reading grid points from
  • Number end - table row to stop reading grid points at (this row will not be read)
  • Function read_point - function that reads the grid location from the table
  • Function read_value - function that reads the value at this grid location from the table
  • Number borderCells - number of empty 'border' cells to add at the grid extremities (for isosurface generation, you may wish to add one border cell to force surface faces to be generated on the boundary of the grid, if the isosurface intersects the grid boundary).
Returns: DenseGridZYX denseGrid - the dense grid
AABB = Lib.determineMinMaxPoints ( ↓begin, ↓end, ↓read_point )

Determine minimum, maximum points from a series of points in a table. These points define an AABB that contains all of the points in the series (some of which may lie on the boundaries of the AABB).

Parameters:
  • Number ↓begin - the first row to read from the table
  • Number ↓end - stop reading when we reach this row (this row is not read)
  • Function ↓read_point - function to read a point from the table
Returns: Object AABB - an object with two properties: min, the minimum point of the AABB; and max, the maximum point of the AABB