You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When clipping with a function, using the clip_surface filter, only polydata can be used as input, and therefore dependent on the resolution of the input surface, as for example:
importpyvistaaspvimportvtk# make a gridded datasetn=21xx=yy=zz=1-np.linspace(0, n, n) *2/ (n-1)
dataset=pv.RectilinearGrid(xx, yy, zz)
# create surface and clip datasetsurface=pv.Cylinder(direction=(0, 0, 1), height=3.0, radius=0.5, resolution=4, capping=False)
clipped=dataset.clip_surface(surface, invert=False)
# Visualize the resultsp=pv.Plotter()
p.add_mesh(surface, color='w', opacity=0.75, label='Surface')
p.add_mesh(clipped, color='gold', show_edges=True, label="clipped", opacity=0.75)
p.add_legend()
p.show()
A high enough resolution is then needed for accurate clipping.
For simplified geometries, implicit functions avoid the necessity of discretising properly the surface.
importpyvistaaspvimportvtk# make a gridded datasetn=21xx=yy=zz=1-np.linspace(0, n, n) *2/ (n-1)
dataset=pv.RectilinearGrid(xx, yy, zz)
# make VTK implicit filtersurface=vtk.vtkCylinder()
surface.SetRadius(0.5)
surface.SetAxis(0.0, 0.0, 1.0)
clipped=dataset._clip_with_function(surface, invert=False)
# Visualize the resultsp=pv.Plotter()
p.add_mesh(clipped, color='gold', show_edges=True, label="clipped", opacity=0.75)
p.add_legend()
p.show()
As seen in the example above, the private method _clip_with_function() already implements the clipping with implicit functions, but there is no corresponding public method in the DataSetFilters class.
Links to VTK Documentation, Examples, or Class Definitions.
For the practical implementation, is it better to have the pyvista.DataSetFilters.clip_surface() method taking both polydata and implicit functions as input OR to create a new pyvista.DataSetFilters.clip_implicit() method?
The latter is closer to the implementation for slicing (pyvista.DataSetFilters.slice_implicit) but slicing has no slice_surface() method, which could be also a nice feature :-)
Describe the feature you would like to be added.
When clipping with a function, using the clip_surface filter, only polydata can be used as input, and therefore dependent on the resolution of the input surface, as for example:
A high enough resolution is then needed for accurate clipping.
For simplified geometries, implicit functions avoid the necessity of discretising properly the surface.
As seen in the example above, the private method _clip_with_function() already implements the clipping with implicit functions, but there is no corresponding public method in the DataSetFilters class.
Links to VTK Documentation, Examples, or Class Definitions.
https://vtk.org/doc/nightly/html/classvtkImplicitFunction.html
Pseudocode or Screenshots
No response
The text was updated successfully, but these errors were encountered: