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 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…
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.
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”):
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…
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.
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: