Extruding a polygon into another or connecting polygons

Dear VTK Users,

I am in a situation where I have a series of ellipses (discretized as polygons with about 20 points) one after the other and I would like to “connect” them in order to create a “tube”-like surface (exterior only, I don’t care about the interior).

In the past I used to use vtkLinearExtrusionFilter and I managed to make it do what I wanted, but I am not sure I can do it this time.

Considering two ellipses one after the other:


I am encountering the problem that, in general, they do not have the same major/minor axes (a & b), the major/minor axes are not in the same proportion, there isn’t an obvious relationship between the ellipse axes for two subsequent ellipses, and the second ellipse may be rotated in 3D compared to the first one.

I am not sure I can make vtkLinearExtrusionFilter work in this case. If I can, I welcome any suggestion on how to do it. If it’s not possible, could you please recommend a way to create a “tube”-like surface by connecting these polygons somehow?

Thank you in advance for any suggestion.


See if vtkRuledSurfaceFilter works for you…

Hi Will,

Thank you for your reply, I was not aware of that filter. I’ve now read a bit about it, and it might be a workable solution but I have a doubt on how to actually associate one line segment of the first ellipse to a line segment of the second.

If the two ellipses are almost “aligned” (I.e., they have the same angle of rotation on their plane), I could simply:

  • Associate the segment that spans the angle 0-2*pi/20 of the first ellipse to the same angle-spanning segment of the second
  • Associate the segment that spans the angle 2pi/20-4pi/20 of the first ellipse to the same angle-spanning segment of the second
  • And so on…

But if the second ellipse is, for example, rotated 90+ degrees compared to the first, then this kind of association might break down as the generated surface could cross itself, although I’m not 100% sure of this as I have trouble visualizing in my head exactly what the outcome would be in this case…

I would love to be proven wrong of course. Or happy if you had any better suggestions on how to do the line-line association in a more intelligent way than what I thought…

Thank you.


As I don’t know the data, let me take a shot in the dark. You might be able to determine the two closest points, one from loop 1, the other loop 2, and set those as the starting points. Alternatively, if you are generating the points, design a process that inherently aligns the points.

The vtkRuledSurfaceFilter seems to work great even in some difficult cases, you can play around with eg.

from vedo import *
c1 = Circle().scale([1,2,1]).pos(1,1,0).c("green4")
c2 = Circle().scale([2,1,1]).rotateY(-30).pos(2,1,2).c("red4")
rib = Ribbon(c1,c2).c("purple4")
show(c1, c2, rib, axes=1)

1 Like

I love happy endings!

Thank you Will & Marco for your suggestions. I have implemented a possible solution using vtkRuledSurfaceFilter - basically translating the vedo code into pure VTK. It works very well most of the times, but I can see these artifacts in some situations (please ignore the green and pink stuff, I am looking at the yellow and grey “tubes”):

These do not appear if I brute-force create the quadrilaterals connecting two consecutive points on two consecutive ellipses:

I am not 100% sure what is happening here. I’d love to use vtkRuledSurfaceFilter as it is slightly faster than my brute-force approach, but I’d rather avoid those holes in there…


I presume that you are adjusting the DistanceFactor… “A DistanceFactor ivar is used to decide when two lines are too far apart to connect.”

Hi Will,

apologies for the late reply. Yes, I did try playing with the distance factor: I put in a kind of large number (5000) for which it would never happen that two lines are too far apart to connect, but I am still getting some weird stuff going on.

These are my ellipses (as displayed in ParaView):

Which seem pretty regular to me. Every single one of them has 18 points.

Once I apply the filter, I see this:

In which it appears that the mesh gets broken in some places somehow (i.e., look at the darker triangles at the top, also in this zoom in:

I am not sure what the problem may be though. I’ll try and investigate by pair of ellipses, but any suggestion you may have is most welcome…

Thank you again.


Can you send me the input data (stacked ellipses)? This certainly looks like a bug unless there is something weird going on in the data…

Dear Will:
How about the missing parts of the vtkRuledSurfaceFilter? I also met this problem when I extrude alone the line in particular shape :

Thank you !!!

Thanks for the bug report. I’ve got heavy deadlines through mid-June and hopefully will be getting to this and other issues on my list. In the meantime, the code is open, don’t be afraid to fix it yourself (or anyone else looking for a challenge :-)).

On my custompath extrusion filtering of a polygon I had the same problem. I wish I could have some time to build vtk and solve this but I’m really busy. Probably another person will solve it faster.

Here is my implementation, it may not be perfect but was able to correct that bug, please look at these lines: