yt.data_objects.construction_data_containers.
YTSurfaceBase
(data_source, surface_field, field_value)[source]¶This surface object 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 object 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.) The object has the properties .vertices and will sample values if a field is requested. The values are interpolated to the center of a given face.
Parameters: | data_source : YTSelectionContainer
surface_field : string
field_value : float
|
---|
References
[R7] | 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.
>>> from yt.units import kpc
>>> sp = ds.sphere("max", (10, "kpc")
>>> surf = ds.surface(sp, "density", 5e-27)
>>> print surf["temperature"]
>>> print surf.vertices
>>> bounds = [(sp.center[i] - 5.0*kpc,
... sp.center[i] + 5.0*kpc) for i in range(3)]
>>> surf.export_ply("my_galaxy.ply", bounds = bounds)
Attributes
Methods