Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add volume clipper #3834

Merged
merged 8 commits into from
Jan 19, 2023
Merged

Add volume clipper #3834

merged 8 commits into from
Jan 19, 2023

Conversation

akaszynski
Copy link
Member

Add a volume clipper widget.

volume-clip-plane-widget

import numpy as np
import pyvista as pv

grid = pv.UniformGrid(dimensions=(200, 200, 200))
grid['scalars'] = np.linalg.norm(grid.center - grid.points, axis=1)
opacity = np.zeros(100)
opacity[::10] = np.geomspace(0.01, 0.75, 10)

pl = pv.Plotter()
pl.add_volume_clip_plane(grid, normal='-x', opacity=opacity[::-1], cmap='magma')
pl.show()

Bonus Modifications

  • Change event_type to interaction_event for consistency.
  • Consistently accept strings in interaction_event everywhere.

@github-actions github-actions bot added documentation Anything related to the documentation/website enhancement Changes that enhance the library labels Jan 17, 2023
@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Merging #3834 (568ba79) into main (bf670b6) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3834      +/-   ##
==========================================
+ Coverage   94.13%   94.16%   +0.02%     
==========================================
  Files          87       87              
  Lines       19111    19125      +14     
==========================================
+ Hits        17991    18009      +18     
+ Misses       1120     1116       -4     

pyvista/plotting/widgets.py Outdated Show resolved Hide resolved
pyvista/plotting/widgets.py Outdated Show resolved Hide resolved
Copy link
Member

@banesullivan banesullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really nice and I appreciate the clean up to the interaction events here

@akaszynski akaszynski merged commit 41de219 into main Jan 19, 2023
@akaszynski akaszynski deleted the feat/volume-clipper branch January 19, 2023 18:50
@banesullivan banesullivan mentioned this pull request Feb 1, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Anything related to the documentation/website enhancement Changes that enhance the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants