mymesh.octree.Function2Octree#

mymesh.octree.Function2Octree(func, bounds, threshold=0, grad=None, mindepth=2, maxdepth=5, strategy='EDerror', eps=0.1)[source]#

Generate an octree structure adapted to an implicit function. Based on octree generation approaches used by [SW05], [ZBS03].

Parameters:
  • func (function) – Implicit function that describes the geometry of the object to be meshed. The function should be of the form v = f(x,y,z,*args,**kwargs) where x, y, and z are numpy arrays of x, y and z coordinates and v is a numpy array of function values.

  • bounds (array_like) – 6 element array, list, or tuple with the minimum and maximum bounds in each direction that the function will be evaluated. This should be formatted as: [xmin, xmax, ymin, ymax, zmin, zmax]

  • threshold (int, optional) – Isosurface level, by default 0

  • grad (_type_, optional) – _description_, by default None

  • mindepth (int, optional) – Minimum octree depth, by default 2. This correspond to a maximum octree node size of L/(2^(mindepth)), where L is the maximum span between the x, y, or z bounds.

  • maxdepth (int, optional) – Maximum octree depth, by default 5. This correspond to a minimum octree node size of L/(2^(maxdepth)), where L is the maximum span between the x, y, or z bounds.

  • strategy (str, optional) –

    Strategy to guide subdivision, by default ‘EDerror’.

    • ’EDerror’: Uses the Euclidian distance error function proposed by

      [ZBS03] to assess the error between linear interpolation within an octree node and with the evaluation of the function at vertices at the next level of refinement. If the error is less than the threshold specified by eps or if there are no sign changes detected, subdivision is halted.

    • ’QEF’: Uses the quadratic error function proposed by

      [SW05]. This approach is not fully implemented yet.

  • eps (float, optional) – Error threshold value used to determine whether further subdivision is necessary, by default 0.01

Returns:

root – The root node of the generated octree.

Return type:

octree.OctreeNode