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:

image

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.

Andrea.

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.

Andrea.

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)

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…

Andrea.

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.

Andrea.

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…