[vtk-developers] Edges, vtkLine, and vtkPolyLine

Wilson, Andrew T atwilso at sandia.gov
Fri May 30 11:53:14 EDT 2008

I'm working on an application where I'm trying to select parts of a
wireframe using vtkExtractSelectedFrustum.  After some chasing, I've found
the following strange behavior:

The GetNumberOfEdges() method on vtkLine and vtkPolyLine returns 0.  The
GetEdge(int id) method returns NULL.  This seems counterintuitive: those
cells are nothing *but* edges.  Is this deliberate?

The downstream effect of this is that it's not possible for me to select in
the middle of an edge because of the following bit of code.  This is from
vtkExtractSelectedFrustum.cxx around line 882:

    if (nedges < 1 &&)
      delete[] vertbuffer;
      return this->IsectDegenerateCell(cell);

IsectDegenerateCell test cells for being in or out by examining the points.
For line and polyline cells that's not sufficient -- we need to test the
lines as well.

The natural solution to this seems to be to have vtkLine and vtkPolyLine
return something reasonable for GetNumberOfEdges() and GetEdge().  If that
happens, there's code later in the method that will check the line segments
against the frustum one by one, which is the right thing.

Is there a reason not to do it this way?  If I don't hear any objections
I'll implement it and see if anything in the test cases breaks.

-- Andy

More information about the vtk-developers mailing list