This adds a couple of mesh rendering data classes to allow 2d slices to be plotted in 3d. The basic approach is to generate a fixed resolution buffer from a YTSlice and build a uniform hexahedral mesh with the frb values as element-center values (which is then triangulated following MeshData). The slice thickness is small (but finite), calculated as a fraction of the cell spacing in the other axes. The new SliceData class handles all this for a single slice (see examples/amr_slices.py) while SliceDataComposite can concatenate multiple SliceData objects without re-generating the meshes so that the rendering will use a single colormap across the slices (see examples/amr_slices_composites.py).
Currently a draft PR because assembling the unstructured mesh is slow -- started with a brute force nested loop that needs to be improved (should be vectorizable, or maybe yt has some utility to help here...). The examples here take ~15 seconds per slice to generate the SliceData objects. Once generated and added to the rendering context, it's fast! (also haven't run any style checks yet...)
Here's a couple screen shots from the single slice example:
This adds a couple of mesh rendering data classes to allow 2d slices to be plotted in 3d. The basic approach is to generate a fixed resolution buffer from a
YTSlice
and build a uniform hexahedral mesh with the frb values as element-center values (which is then triangulated followingMeshData
). The slice thickness is small (but finite), calculated as a fraction of the cell spacing in the other axes. The newSliceData
class handles all this for a single slice (seeexamples/amr_slices.py
) whileSliceDataComposite
can concatenate multipleSliceData
objects without re-generating the meshes so that the rendering will use a single colormap across the slices (seeexamples/amr_slices_composites.py
).Currently a draft PR because assembling the unstructured mesh is slow -- started with a brute force nested loop that needs to be improved (should be vectorizable, or maybe yt has some utility to help here...). The examples here take ~15 seconds per slice to generate the
SliceData
objects. Once generated and added to the rendering context, it's fast! (also haven't run any style checks yet...)Here's a couple screen shots from the single slice example: