- case VTK_QUADRATIC_HEXAHEDRON: {
- aCellType = VTK_POLYGON;
- numFacePts = 8;
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[17];
- aNewPts[4] = pts[5];
- aNewPts[5] = pts[12];
- aNewPts[6] = pts[4];
- aNewPts[7] = pts[16];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[1];
- aNewPts[1] = pts[9];
- aNewPts[2] = pts[2];
- aNewPts[3] = pts[18];
- aNewPts[4] = pts[6];
- aNewPts[5] = pts[13];
- aNewPts[6] = pts[5];
- aNewPts[7] = pts[17];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[2];
- aNewPts[1] = pts[10];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[19];
- aNewPts[4] = pts[7];
- aNewPts[5] = pts[14];
- aNewPts[6] = pts[6];
- aNewPts[7] = pts[18];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[3];
- aNewPts[1] = pts[11];
- aNewPts[2] = pts[0];
- aNewPts[3] = pts[16];
- aNewPts[4] = pts[4];
- aNewPts[5] = pts[15];
- aNewPts[6] = pts[7];
- aNewPts[7] = pts[19];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[9];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[10];
- aNewPts[6] = pts[3];
- aNewPts[7] = pts[11];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[4];
- aNewPts[1] = pts[12];
- aNewPts[2] = pts[5];
- aNewPts[3] = pts[13];
- aNewPts[4] = pts[6];
- aNewPts[5] = pts[14];
- aNewPts[6] = pts[7];
- aNewPts[7] = pts[15];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- break;
- }
- case VTK_QUADRATIC_PYRAMID: {
- aCellType = VTK_POLYGON;
- numFacePts = 6;
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[12];
- aNewPts[4] = pts[4];
- aNewPts[5] = pts[9];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[9];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[10];
- aNewPts[4] = pts[1];
- aNewPts[5] = pts[5];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[1];
- aNewPts[1] = pts[10];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[11];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[6];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[2];
- aNewPts[1] = pts[11];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[12];
- aNewPts[4] = pts[3];
- aNewPts[5] = pts[7];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- numFacePts = 8;
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[5];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[6];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[7];
- aNewPts[6] = pts[3];
- aNewPts[7] = pts[8];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
- outputCD->CopyData(cd,cellId,newCellId);
-
+ case VTK_QUADRATIC_HEXAHEDRON:
+ case VTK_QUADRATIC_PYRAMID:
+ {
+ aCellType = VTK_POLY_LINE;
+ input->GetCell(cellId,cell);
+ if ( myShowInside )
+ {
+ int nbEdges = cell->GetNumberOfEdges();
+ for ( int edgeId = 0; edgeId < nbEdges; ++edgeId )
+ {
+ vtkCell * edge = cell->GetEdge( edgeId );
+ if ( toShowEdge( edge->GetPointId(0), edge->GetPointId(2), cellId, input ))
+ {
+ aNewPts[0] = edge->GetPointId(0);
+ aNewPts[1] = edge->GetPointId(2);
+ aNewPts[2] = edge->GetPointId(1);
+ newCellId = output->InsertNextCell( aCellType, 3, aNewPts );
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ }
+ else
+ {
+ int nbCoincident = 0;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+ int nbPnt = npts - cell->GetNumberOfEdges();
+ faceIdsTmp->SetNumberOfIds( nbPnt );
+ for ( int ai = 0; ai < nbPnt; ai++ )
+ faceIdsTmp->SetId( ai, pts[ai] );
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ nbCoincident = cellIdsTmp->GetNumberOfIds();
+#endif
+ midPoints.clear();
+ int nbFaces = cell->GetNumberOfFaces();
+ for ( faceId = 0; faceId < nbFaces; faceId++ )
+ {
+ vtkCell * face = cell->GetFace( faceId );
+ input->GetCellNeighbors( cellId, face->GetPointIds(), cellIds );
+ int nbNeighbors = cellIds->GetNumberOfIds() - nbCoincident;
+ if ( nbNeighbors <= 0 )
+ {
+ int nbEdges = face->GetNumberOfPoints() / 2;
+ for ( int edgeId = 0; edgeId < nbEdges; ++edgeId )
+ {
+ vtkIdType p1 = ( edgeId ); // corner
+ vtkIdType p2 = ( edgeId + nbEdges ); // medium
+ vtkIdType p3 = ( edgeId + 1 ) % nbEdges; // next corner
+ faceIdsTmp->SetNumberOfIds( 2 );
+ faceIdsTmp->SetId( 0, face->GetPointId(p2) );
+ faceIdsTmp->SetId( 1, face->GetPointId(p1) );
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ bool process;
+ switch ( cellIdsTmp->GetNumberOfIds() ) {
+ case 0: // the edge belong to this cell only
+ // avoid adding it when treating another face
+ process = midPoints.insert( face->GetPointId(p2) ).second; break;
+ case 1: // the edge is shared by two cells
+ process = ( cellIdsTmp->GetId(0) < cellId ); break;
+ default: // the edge is shared by >2 cells
+ process = ( cellIdsTmp->GetId(0) < cellId ); break;
+ }
+ if ( process )
+ {
+ aNewPts[0] = face->GetPointId( p1 );
+ aNewPts[1] = face->GetPointId( p2 );
+ aNewPts[2] = face->GetPointId( p3 );
+ newCellId = output->InsertNextCell( aCellType, 3, aNewPts );
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ }
+ }
+ }