簡體   English   中英

找到 2 個網格之間的交線

[英]Find an intersection line between 2 meshes

我正在尋找 python 中 2 個網格之間的交線(段)我試過這個:

import pyvista as pv
import vtk

def get_mesh_intersection(mesh1, mesh2):
    '''
    Find the intersection volume between mesh vtk objects
    and return the volume of intersection
    '''
    alg = vtk.vtkBooleanOperationPolyDataFilter()
    alg.SetInputData(0, mesh2)
    alg.SetInputData(1, mesh1)
    alg.SetOperationToIntersection()
    alg.Update()
    intersection = pv.wrap(alg.GetOutput())
    return intersection

intersection = get_mesh_intersection(grid1, grid2)

我可以從intersection提取線嗎? 如何? 我看到我可以得到intersection.volume intersection.area intersection.pointsintersection.points是我要找的嗎?

我認為您應該使用vtkIntersectionPolyDataFilter而不是 boolean 操作過濾器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM