Commit 5df73b10 authored by T.J. Corona's avatar T.J. Corona

In vtkVolumeOfRevolutionFilter, fix assignments to output cell locations.

parent deef9004
......@@ -41,6 +41,9 @@
#include <vtkPolygon.h>
#include <vtkTriangleStrip.h>
#include <vtkCellIterator.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCharArray.h>
#include <vtkIntArray.h>
#include <vtkDataArray.h>
......@@ -243,6 +246,32 @@ int TestVolumeOfRevolutionFilter( int argc, char * argv [] )
revolve->SetAxisPosition(position);
revolve->SetAxisDirection(direction);
revolve->SetInputData(pd);
revolve->Update();
// test that the auxiliary arrays in vtkUnstructuredGrid output are correct
{
vtkUnstructuredGrid* ug = revolve->GetOutput();
vtkCellIterator *it = ug->NewCellIterator();
for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())
{
vtkIdType npts, *ptIds;
ug->GetCellPoints(it->GetCellId(), npts, ptIds);
vtkIdType numberOfPoints = it->GetNumberOfPoints();
if (npts != numberOfPoints)
{
return 1;
}
vtkIdList *pointIds = it->GetPointIds();
for (vtkIdType i=0;i<numberOfPoints;i++)
{
if (ptIds[i] != pointIds->GetId(i))
{
return 1;
}
}
}
it->Delete();
}
vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;
surfaceFilter->SetInputConnection(revolve->GetOutputPort());
......
......@@ -107,7 +107,7 @@ void Revolve<VTK_VERTEX>(vtkIdList* pointIds, vtkIdType n2DPoints,
newPtIds[1] = (pointIds->GetId(0) +
((i+1)%(resolution + partialSweep))*n2DPoints);
newCellId = connectivity->InsertNextCell(2, newPtIds);
locations->InsertNextValue(connectivity->GetTraversalLocation());
locations->InsertNextValue(connectivity->GetInsertLocation(0));
types->InsertNextValue(VTK_LINE);
outCd->CopyData(inCd, cellId, newCellId);
newPtIds[0] = newPtIds[1];
......@@ -156,7 +156,7 @@ void Revolve<VTK_LINE>(vtkIdList* pointIds, vtkIdType n2DPoints, int resolution,
pointIds->GetId(j) + ((i+1)%(resolution + partialSweep))*n2DPoints;
}
newCellId = connectivity->InsertNextCell(2*nPoints, newPtIds);
locations->InsertNextValue(connectivity->GetTraversalLocation());
locations->InsertNextValue(connectivity->GetInsertLocation(0));
types->InsertNextValue(VTK_QUAD);
outCd->CopyData(inCd, cellId, newCellId);
for (vtkIdType j=0;j<nPoints;j++)
......@@ -212,7 +212,7 @@ void Revolve<VTK_TRIANGLE>(vtkIdList* pointIds, vtkIdType n2DPoints,
pointIds->GetId(j) + ((i+1)%(resolution + partialSweep))*n2DPoints;
}
newCellId = connectivity->InsertNextCell(2*nPoints, newPtIds);
locations->InsertNextValue(connectivity->GetTraversalLocation());
locations->InsertNextValue(connectivity->GetInsertLocation(0));
types->InsertNextValue(VTK_WEDGE);
outCd->CopyData(inCd, cellId, newCellId);
for (vtkIdType j=0;j<nPoints;j++)
......@@ -268,7 +268,7 @@ void Revolve<VTK_QUAD>(vtkIdList* pointIds, vtkIdType n2DPoints, int resolution,
pointIds->GetId(j) + ((i+1)%(resolution + partialSweep))*n2DPoints;
}
newCellId = connectivity->InsertNextCell(2*nPoints, newPtIds);
locations->InsertNextValue(connectivity->GetTraversalLocation());
locations->InsertNextValue(connectivity->GetInsertLocation(0));
types->InsertNextValue(VTK_HEXAHEDRON);
outCd->CopyData(inCd, cellId, newCellId);
for (vtkIdType j=0; j<nPoints; j++)
......@@ -302,7 +302,7 @@ void Revolve<VTK_PIXEL>(vtkIdList* pointIds, vtkIdType n2DPoints,
pointIds->GetId(j) + ((i+1)%(resolution + partialSweep))*n2DPoints;
}
newCellId = connectivity->InsertNextCell(2*nPoints, newPtIds);
locations->InsertNextValue(connectivity->GetTraversalLocation());
locations->InsertNextValue(connectivity->GetInsertLocation(0));
types->InsertNextValue(VTK_HEXAHEDRON);
outCd->CopyData(inCd, cellId, newCellId);
for (vtkIdType j=0; j<nPoints; j++)
......@@ -367,7 +367,7 @@ void Revolve<VTK_POLYGON>(vtkIdList* pointIds, vtkIdType n2DPoints,
newFacePtIds[j+2][3] = newFacePtIds[1][nPoly-1-j];
}
newCellId = connectivity->InsertNextCell(7*nPoly+3, &newPtIds[0]);
locations->InsertNextValue(connectivity->GetTraversalLocation());
locations->InsertNextValue(connectivity->GetInsertLocation(0));
types->InsertNextValue(VTK_POLYHEDRON);
outCd->CopyData(inCd, cellId, newCellId);
for (vtkIdType j=0; j<nPoly; j++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment