简体   繁体   English

找到 2 个网格之间的交线

[英]Find an intersection line between 2 meshes

I am looking to find an intersection line(segments) between 2 meshes in python I tried this:我正在寻找 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)

Can I extract from the intersection the line?我可以从intersection提取线吗? how?如何? I see that I can get intersection.volume intersection.area intersection.points Is intersection.points is what I am looking for?我看到我可以得到intersection.volume intersection.area intersection.pointsintersection.points是我要找的吗?

I think you should use vtkIntersectionPolyDataFilter instead of the boolean operation filter.我认为您应该使用vtkIntersectionPolyDataFilter而不是 boolean 操作过滤器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM