bfieldtools.contour.scalar_contour

bfieldtools.contour.scalar_contour(mesh, scalars, N_contours=10, contours=None, return_values=False)

Computes contour loops (isolines) for a scalar function defined on a mesh. The winding direction of the loops is defined according to the rotated gradient of the scalar

Parameters
mesh: Trimesh object

Trimesh object containing the mesh on which the scalar function is defined

scalars: array-like or StreamFunction

Vector containing the values of the scalar function at each of the mesh vertices. If StreamFunction, uses the vertex-wise values

N_contours: int

Number of contours to generate

contours: array-like

Optional argument for manual input of contour levels. Overrides N_contours

return_values: Boolean

If True, also return contour values

Returns
contour_polys: list

list with length N_contours. Each list element is anumpy array containing the coordinats of each polygon vertex.

contour_values: array-like

Vector containing the scalar function value for each contour line, returned if return_values is True