I want to intersect 2 planes using PyVista and visualize the result but I got an error.
I tried the following code:
import pyvista as pv
p1 = pv.Plane(center=(0, 0, 0), direction=(0, 0, 1))
p2 = pv.Plane(center=(0, 0, 0), direction=(1, 0, 0))
intersection = p1.intersection(p2)
But I have the following error:
2023-03-23 16:19:35.916 ( 0.291s) [ ] vtkPointLocator.cxx:868 ERR| vtkPointLocator (000001D4ED1030E0): No points to subdivideERROR:root:No points to subdivide
2023-03-23 16:19:35.921 ( 0.296s) [ ]vtkIntersectionPolyData:2410 WARN| No Intersection between objects
How can I perform this intersection?
It seems that this filter doesn't play nicely with non-triangle faces. I don't know how general an issue this is, because I didn't see any warnings in the VTK docs. Perhaps we should add some to PyVista.
Here's your original setup:
Note the square-shaped faces. It's especially unfortunate that the intersection line overlaps with edges from both meshes, but I tried shifting the planes by half a face and it didn't change the outcome.
What helps is triangulating your meshes:
Now the intersection works as you'd expect: