Helper functions


resolution_conversion(resolution)

Converts the given resolution so that there are odd number of points along each axis.

Parameters:
  • resolution (int) –

    Given resolution along an axis.

Returns:
  • int

    converted Resolution along an axis.

smarter_reshape(pattern, resolution)

Converts the Signed Distance field point cloud into a grid.

Parameters:
  • pattern (ndarray) –

    Signed Distance field

  • resolution (tuple | list | ndarray | ndarray) –

    Resolution of the grid, determining the number of points along each axis.

Returns:
  • ndarray

    Signed distance field on a rectilinear grid.

vector_smarter_reshape(pattern, resolution)

Converts a vector field point cloud into a grid.

Parameters:
  • pattern (ndarray) –

    Vector field

  • resolution (tuple | list | ndarray | ndarray) –

    Resolution of the grid, determining the number of points along each axis.

Returns:
  • ndarray

    Vector field on a rectilinear grid of shape (3, resolution[0], resolution[1], resolution[2]).

nd_vector_smarter_reshape(pattern, resolution)

Converts an n-dimensional vector field point cloud into a grid.

Parameters:
  • pattern (ndarray) –

    Vector field

  • resolution (tuple | list | ndarray | ndarray) –

    Resolution of the grid, determining the number of points along each axis.

Returns:
  • ndarray

    Vector field on a rectilinear grid of shape (ND, resolution[0], resolution[1], resolution[2]).