[vtkusers] converting output of vtkContourFilter from line segments to closed loop polyline

Richard Strelitz strelitz at lanl.gov
Thu Jun 22 17:30:15 EDT 2006

I want to use contours (and isosurfaces) as discrete objects.  For 
example, while vtkContourFilter generates a multitude of 2-point line 
segment cells, I want to string together those pieces belonging to the 
same contour to be shown as an N-point polyline.  Absent special cases 
(hitting the boundary, duplicate points, etc.) the problem is 
---Assume each point belongs to 2 and only 2 line segments.
       start with a point,
        connect it to the point on the other end of 1 of its lines,
        mark that line as used,
        and then look for the line that contains that point that is unused.
   Continue until you have either
         gotten back to the seed point,
           or you find a point that belongs to 2 lines, both of which 
are used.
Choose next unused point as next seed and continue until (points) are 

  Is there a method or class that I have overlooked?  Wouldn't this be a 
nice thing to have?
Suggestions, comments, hints and even flames, welcome.

Richard Strelitz, Vis staff,
Advanced Computing Lab, LANL

More information about the vtkusers mailing list