From 21a5104221ce0d67e95cf0edf6b4732ab3e06db7 Mon Sep 17 00:00:00 2001
From: Takuya OSHIMA <oshima@eng.niigata-u.ac.jp>
Date: Wed, 5 Oct 2011 22:19:16 +0900
Subject: [PATCH] Fix polyhedron handling in vtkAppendFilter

---
 Graphics/vtkAppendFilter.cxx |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Graphics/vtkAppendFilter.cxx b/Graphics/vtkAppendFilter.cxx
index 6a07ad4..bd3adc2 100644
--- a/Graphics/vtkAppendFilter.cxx
+++ b/Graphics/vtkAppendFilter.cxx
@@ -261,17 +261,18 @@ int vtkAppendFilter::RequestData(
       vtkUnstructuredGrid *ug = vtkUnstructuredGrid::SafeDownCast(ds);
       for (cellId=0; cellId < numCells && !abort; cellId++)
         {
+        newPtIds->Reset ();
         if (ug && ds->GetCellType(cellId) == VTK_POLYHEDRON )
           {
           vtkIdType nfaces, *facePtIds;
           ug->GetFaceStream(cellId,nfaces,facePtIds);
           for(vtkIdType id=0; id < nfaces; ++id)
             {
-            vtkIdType nPoints = *facePtIds;
+            vtkIdType nPoints = *facePtIds++;
             newPtIds->InsertNextId(nPoints);
-            for (vtkIdType j=0; j <= nPoints; ++j)
+            for (vtkIdType j=1; j <= nPoints; ++j)
               {
-              newPtIds->InsertNextId(*(++facePtIds)+ptOffset);
+              newPtIds->InsertNextId(*(facePtIds++)+ptOffset);
               }
             }
           output->InsertNextCell(VTK_POLYHEDRON,nfaces,newPtIds->GetPointer(0));
@@ -279,7 +280,6 @@ int vtkAppendFilter::RequestData(
         else
           {
           ds->GetCellPoints(cellId, ptIds);
-          newPtIds->Reset ();
           for (i=0; i < ptIds->GetNumberOfIds(); i++)
             {
             newPtIds->InsertId(i,ptIds->GetId(i)+ptOffset);
-- 
1.7.0.4

