How to create a cylinder implicit with specified height

I want to create a implicit cylinder with specified height. From VTK doc, it says The cylinder is infinite in extent. To truncate the cylinder in modeling operations use the vtkImplicitBoolean in combination with clipping planes.

So I use the following code to truncate the cylinder.

auto plane1 = vtkSmartPointer<vtkPlane>::New();
auto plane2 = vtkSmartPointer<vtkPlane>::New();

auto cylinder = vtkSmartPointer<vtkCylinder>::New();
auto theCylinder = vtkSmartPointer<vtkImplicitBoolean>::New();

But the result has two caps on the cylinder. I only want to get specified height of cylindrical surface that is not closed.

How can I fix it.

Do you need the implicit function part of vtkCylinder, or are you just trying to visualize a cylinder?

If you just need to visualize a cylinder, you may find it easier to use vtkCylinderSource instead. The vtkCylinderSource class has a SetCapping method which allows you to turn capping on or off.

I need the implicit function part of vtkCylinder which looks like vtkCylinderSource with SetCapping(off). Because I will use vtkImplicitBoolean with cylinder and other implicit functions later.

The vtkImplicitFunction results have value 0 on the surface, are positive outside the surface, and negative inside the surface. Right now, all the points on the cylinder caps have value 0. Do you care if they get transformed into “inside” or “outside” values? Do the values themselves matter? I’m sure there’s a way to get rid of the caps, but I don’t know whether it’s important for your application to maintain the vtkCylinder values themselves in between the capping planes, or just the sense of “not on the surface”, or whether inside/outside really matters for you. So I’m not sure what to suggest.

Maybe a vtkCylinderSource can get you a polydata which you can use with vtkImplicitPolyDataDistance if you need implicit function capabilities, but with an uncapped cylinder.

If you could explain further what properties of the result you care about, maybe one of us can suggest a next step.

Thank you for your help. Now I get a solution. After use vtkSampleFunction and vtkContourFilter to make implicit functin to polydata, I use vtkClipPolyData to cut the caps.

I am a newbie. My question is not clearly expressed. I just want to get the union of several tube(without caps). But I find that vtkBooleanOperationPolyDataFilter perform not well in some cases. So I use vtkImplicitBoolean and it perform well. But I do not know how to get an implicit function of a tube that does not have caps.

I used the vtkImplicitPolyDataDistance. It did not perform well. It creates tube infinite in extent after vtkSampleFunction and vtkContourFilter.

I do need the implicit functions because I will throw them in the vtkImplicitBoolean.