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

List of interpolation algorithms and boolean/topological operations #93

Open
banesullivan opened this issue Dec 23, 2019 · 5 comments
Open
Labels
add-to-gallery For examples that need to be added to the gallery in the docs filtering General topics around filtering and usage of filters FRIDocs

Comments

@banesullivan
Copy link
Member

banesullivan commented Dec 23, 2019

Description

I was asked:

is there a list of interpolation algorithms and boolean/topological operations (intersect, cut, merge, etc.) implemented in PyVista? The tutorials are quite focused on visualization but I understand that there is much more.

We should create an example in the docs gallery to showcase all of the boolean operations with PolyData

@banesullivan banesullivan added the filtering General topics around filtering and usage of filters label Dec 23, 2019
@banesullivan
Copy link
Member Author

banesullivan commented Dec 23, 2019

boolean/topological operations (intersect, cut, etc.) methods are implemented for PolyData mesh types only and are accessible directly from any PolyData mesh. Check out https://docs.pyvista.org/core/filters.html#polydata-filters and take a look at the following filters:

  • boolean_add
  • boolean_cut
  • boolean_difference
  • boolean_union

For merging, the + operator can be used between any two meshes in PyVista (see pyvista/pyvista#510) which simply calls the .merge() filter to combine any two meshes.

Interpolation algorithms - we are lacking here, but the .interpolate() and .sample() filters will be what you want to use here. All we have are simple Gaussian kernels for the interpolations. This example shows how to use these filters.

@banesullivan banesullivan added FRIDocs add-to-gallery For examples that need to be added to the gallery in the docs labels Jan 9, 2020
@Sunil7545
Copy link

Hi Bane,
These methods are also applicable surfaces with boundaries or they are working only for the watertight surfaces ?

Thanks
Sunil

@akaszynski
Copy link
Member

@Sunil7545,

It looks like operations with non-manifold surfaces aren't always successful. For example, the following leads to a segfault:

import pyvista

sphere = pyvista.Sphere()
plane = pyvista.Plane(i_size=1.5, j_size=1.5).triangulate()
(sphere - plane).plot(color='w', show_edges=True)

However, the following works:

import pyvista

sphere = pyvista.Sphere()
sphere2 = pyvista.Sphere(center=(-0.25, -0.25, 0.25))
cut_sphere = sphere.boolean_difference(sphere2)

pl = pyvista.Plotter()
pl.add_mesh(sphere, style='wireframe')
pl.add_mesh(sphere2, style='wireframe')
pl.add_mesh(cut_sphere, color='r')
pl.show()

image

So, to answer your question, non-manifold mesh boolean operations may fail, though I've been able to successfully perform them in some circumstances, for example:
image

@Sunil7545
Copy link

Thank you very much.

@punyidea
Copy link

Wanted to add to this thread, that the .probe() filter is also helpful if one has a point set, and one is interested in evaluating the mesh at specific points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add-to-gallery For examples that need to be added to the gallery in the docs filtering General topics around filtering and usage of filters FRIDocs
Projects
None yet
Development

No branches or pull requests

4 participants