예제 #1
0
def clipByPlane(polyData, planeOrigin, planeNormal):
    f = vtk.vtkClipPolyData()
    f.SetInput(polyData)
    p = vtk.vtkPlane()
    p.SetOrigin(planeOrigin)
    p.SetNormal(planeNormal)
    f.SetClipFunction(p)
    f.Update()
    return shallowCopy(f.GetOutput())
예제 #2
0
def computePlanarConvexHull(polyData, expectedNormal=None):

    plane = vtk.vtkPlane()
    vtk.vtkSurfaceFitter.ComputePlane(polyData, plane)

    if expectedNormal is not None:
        planeNormal = plane.GetNormal()
        if np.dot(planeNormal, expectedNormal) < 0:
            plane.SetNormal(-1 * np.array(planeNormal))

    chull = vtk.vtkPolyData()
    vtk.vtkSurfaceFitter.ComputeConvexHull(polyData, plane, chull)
    return FieldContainer(points=polyData, convexHull=chull, plane=plane)
def computePlanarConvexHull(polyData, expectedNormal=None):

    plane = vtk.vtkPlane()
    vtk.vtkSurfaceFitter.ComputePlane(polyData, plane)

    if expectedNormal is not None:
        planeNormal = plane.GetNormal()
        if np.dot(planeNormal, expectedNormal) < 0:
            plane.SetNormal(-1*np.array(planeNormal))

    chull = vtk.vtkPolyData()
    vtk.vtkSurfaceFitter.ComputeConvexHull(polyData, plane, chull)
    return FieldContainer(points=polyData, convexHull=chull, plane=plane)