vtkBandedPolyDataContourFilter outputs degenerate polygons
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
vtkBandedPolyDataContourFilter inserts cells of less than 3 points into the poly cell array. If the outputed polydata is picked with a vtkCellPicker... crash. I'll submit a separate bug report for the picking procedure. I haven't gone through the vtkBandedPolyDataContourFilter algorithm so this is a check rather than a fix- but it seems to work:
RCS file: /cvsroot/VTK/VTK/Graphics/vtkBandedPolyDataContourFilter.cxx,v retrieving revision 1.37 diff -u -r1.37 vtkBandedPolyDataContourFilter.cxx --- vtkBandedPolyDataContourFilter.cxx 22 Jan 2004 00:06:45 -0000 1.37 +++ vtkBandedPolyDataContourFilter.cxx 27 Mar 2004 01:20:41 -0000 @@ -592,7 +592,7 @@ }
//Trivial output - completely in a contour band or a triangle
-
if ( ! intersectionPoint || numFullPts <= 3 )
-
if ( ! intersectionPoint || numFullPts == 3 ) { cellId = this->InsertCell(newPolys,npts,pts,cellId,s[idx],newScalars); continue;
@@ -617,8 +617,11 @@ { newPolygon[numPolyPoints++] = fullPoly[(mL+i)%numFullPts]; }
-
cellId = this->InsertCell(newPolys,numPolyPoints,newPolygon,
-
if (numPolyPoints >= 3)
-
{
-
cellId = this->InsertCell(newPolys,numPolyPoints,newPolygon, cellId,s[idx],newScalars);
-
} if ( this->GenerateContourEdges ) { contourEdges->InsertNextCell(2);
@@ -634,7 +637,7 @@ while ( m2R != m2L ) { numPointsToAdd = (mL > mR ? mL-mR+1 : numFullPts-(mR-mL)+1);
-
if ( numPointsToAdd <= 3 )
-
if ( numPointsToAdd == 3 ) {//just a triangle left for (numPolyPoints=0, i=0; i<numPointsToAdd; i++) {
@@ -676,6 +679,10 @@ }
//add the polygon
-
if (numPolyPoints < 3)
-
{
-
break;
-
} cellId = this->InsertCell(newPolys,numPolyPoints,newPolygon, cellId,s[mR],newScalars); if ( this->GenerateContourEdges )