YTEllipsoidBase.
extract_isocontours
(field, value, filename=None, rescale=False, sample_values=None)¶This identifies isocontours on a cell-by-cell basis, with no consideration of global connectedness, and returns the vertices of the Triangles in that isocontour.
This function simply returns the vertices of all the triangles calculated by the marching cubes algorithm; for more complex operations, such as identifying connected sets of cells above a given threshold, see the extract_connected_sets function. This is more useful for calculating, for instance, total isocontour area, or visualizing in an external program (such as MeshLab.)
Parameters: | field : string
value : float
filename : string, optional
rescale : bool, optional
sample_values : string, optional
|
---|---|
Returns: | verts : array of floats
samples : array of floats
|
References
[R20] | Marching Cubes: http://en.wikipedia.org/wiki/Marching_cubes |
Examples
This will create a data object, find a nice value in the center, and output the vertices to “triangles.obj” after rescaling them.
>>> dd = ds.all_data()
>>> rho = dd.quantities["WeightedAverageQuantity"](
... "Density", weight="CellMassMsun")
>>> verts = dd.extract_isocontours("Density", rho,
... "triangles.obj", True)