注釈
Go to the end to download the full example code.
サーフェス内のセルを抽出#
別のメッシュの閉じたサーフェスの内側または外側に存在するメッシュ内のセルを抽出する
from __future__ import annotations
import pyvista as pv
from pyvista import examples
mesh = examples.download_cow()
cpos = [(13.0, 7.6, -13.85), (0.44, -0.4, -0.37), (-0.28, 0.9, 0.3)]
dargs = dict(show_edges=True)
# Rotate the mesh to have a second mesh
rot = mesh.rotate_y(90, inplace=False)
p = pv.Plotter()
p.add_mesh(mesh, color='Crimson', **dargs)
p.add_mesh(rot, color='mintcream', opacity=0.35, **dargs)
p.camera_position = cpos
p.show()

内側の点を1,外側の点を0でマークします.
select = mesh.select_enclosed_points(rot)
select
2つのメッシュ,1つは完全に内側,もう1つは完全に外側を抽出します.
inside = select.threshold(0.5)
outside = select.threshold(0.5, invert=True)
結果を表示する

Total running time of the script: (0 minutes 0.688 seconds)