hemispherical cap with hole at the bottom

Petr Vokac <[email protected]> Sun, 14 Apr 2019 08:30:45 -0700 (MST)
Newsgroups gmane.comp.lib.vtk.user
Message-ID <[email protected]>
I am trying to create hemispherical cap using two spheres, clipping them by
plane - it works, and clipping them by cylinder - it does not work as it
leaves two surfaces unconnected, why?

python script:

#!/usr/bin/env python

import vtk
sphere = vtk.vtkSphereSource()
sphere.SetRadius(10.0)

spherei = vtk.vtkSphereSource()
spherei.SetRadius(8.0)

sphereir=vtk.vtkReverseSense()
sphereir.SetInputConnection(spherei.GetOutputPort())

ext=vtk.vtkAppendPolyData()
ext.AddInputConnection(sphere.GetOutputPort())
ext.AddInputConnection(sphereir.GetOutputPort())

plane = vtk.vtkPlane()
plane.SetOrigin([0.0,0.0,0.0])
plane.SetNormal([0.0,-1.0,0.0])

clipclose=vtk.vtkClipClosedSurface()
pc = vtk.vtkPlaneCollection()
pc.AddItem(plane)
clipclose.SetClippingPlanes(pc)
clipclose.SetInputConnection(ext.GetOutputPort())

cyl = vtk.vtkCylinder()
cyl.SetCenter(0,0,0)
cyl.SetRadius(5.0)
ib = vtk.vtkImplicitBoolean()
ib.AddFunction(cyl)

clipper = vtk.vtkClipPolyData()
clipper.SetInputConnection(clipclose.GetOutputPort())
clipper.SetClipFunction(ib)
clipper.GenerateClippedOutputOn()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(clipper.GetOutputPort())

actor = vtk.vtkActor()
actor.SetMapper(mapper)

ren = vtk.vtkRenderer()
ren.AddActor(actor)
ren.ResetCamera()

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

iren.Initialize()
renWin.Render()
iren.Start()






--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers