Commit 2f4a9cad authored by David Thompson's avatar David Thompson
Browse files

Fix problems processing polyhedron connectivity.

Several filters incorrectly process polyhedra because of
misunderstandings of how their connectivity is stored or
simple math errors in computing connectivity offsets.
Fix them.

Change-Id: Icce8becea56567b869277d0d265e3f9092b7eb98
parent 2d67f639
......@@ -305,11 +305,11 @@ int vtkAppendFilter::RequestData(
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=0; j < nPoints; ++j)
{
newPtIds->InsertNextId(*(++facePtIds)+ptOffset);
newPtIds->InsertNextId(*(facePtIds++)+ptOffset);
}
}
output->InsertNextCell(VTK_POLYHEDRON,nfaces,newPtIds->GetPointer(0));
......
......@@ -2063,7 +2063,7 @@ void vtkDataSetSurfaceFilter::InsertPolygonInHash(vtkIdType* ids,
// find the index to the smallest id
vtkIdType offset = 0;
for(int i=1; i<numPts; i++)
for(int i=0; i < numPts; i++)
{
if(ids[i] < ids[offset])
{
......@@ -2089,11 +2089,11 @@ void vtkDataSetSurfaceFilter::InsertPolygonInHash(vtkIdType* ids,
bool match = true;
if (numPts == quad->numPts)
{
if ( tab[1] == quad->ptArray[1])
if ( tab[0] == quad->ptArray[0])
{
// if the first two points match loop through forwards
// checking all points
for (int i = 2; i < numPts; i++)
for (int i = 1; i < numPts; i++)
{
if ( tab[i] != quad->ptArray[i])
{
......@@ -2102,13 +2102,13 @@ void vtkDataSetSurfaceFilter::InsertPolygonInHash(vtkIdType* ids,
}
}
}
else if (tab[numPts-1] == quad->ptArray[1])
else if (tab[numPts-1] == quad->ptArray[0])
{
// the first two points match with the opposite sense.
// loop though comparing the correct sense
for (int i = 2; i < numPts; i++)
for (int i = 1; i < numPts; i++)
{
if ( tab[numPts - i] != quad->ptArray[i])
if ( tab[numPts - i - 1] != quad->ptArray[i])
{
match = false;
break;
......
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