+ case VTK_TRIQUADRATIC_HEXAHEDRON:
+ case VTK_QUADRATIC_WEDGE:
+ case VTK_QUADRATIC_PYRAMID:
+
+ if(!myIsWireframeMode)
+ {
+ input->GetCell(cellId,cell);
+ vtkIdList *lpts = vtkIdList::New();
+ vtkPoints *coords = vtkPoints::New();
+ vtkIdList *cellIds = vtkIdList::New();
+ vtkIdType newCellId;
+
+ if ( cell->GetCellDimension() == 1 ) {
+ vtkIdType arcResult = -1;
+ if(myIsBuildArc) {
+ arcResult = Build1DArc(cellId, input, output, pts, myMaxArcAngle);
+ newCellId = arcResult;
+ }
+
+ if(!myIsBuildArc || arcResult == -1 ) {
+ aCellType = VTK_LINE;
+ numFacePts = 2;
+ cell->Triangulate(0,lpts,coords);
+ for (i=0; i < lpts->GetNumberOfIds(); i+=2) {
+ aNewPts[0] = lpts->GetId(i);
+ aNewPts[1] = lpts->GetId(i+1);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ else {
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ else if ( cell->GetCellDimension() == 2 ) {
+ if(!myIsBuildArc) {
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ cell->Triangulate(0,lpts,coords);
+ for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
+ aNewPts[0] = lpts->GetId(i);
+ aNewPts[1] = lpts->GetId(i+1);
+ aNewPts[2] = lpts->GetId(i+2);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ else{
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds,true);
+ }
+ }
+ else //3D nonlinear cell
+ {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+ if ( !myShowInside )
+ {
+ int npts1 = 0;
+ switch (aCellType ){
+ case VTK_QUADRATIC_TETRA: npts1 = 4; break;
+ case VTK_QUADRATIC_HEXAHEDRON: npts1 = 8; break;
+ case VTK_TRIQUADRATIC_HEXAHEDRON: npts1 = 8; break;
+ case VTK_QUADRATIC_WEDGE: npts1 = 6; break;
+ case VTK_QUADRATIC_PYRAMID: npts1 = 5; break;
+ }
+ faceIdsTmp->SetNumberOfIds( npts1 );
+ if ( npts1 > 0 ) {
+ for (int ai=0; ai<npts1; ai++)
+ faceIdsTmp->SetId( ai, pts[ai] );
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ }
+ }
+#endif
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ int nbNeighbors = 0;
+ for (int j=0; j < cell->GetNumberOfFaces(); j++)
+ {
+ vtkCell *face = cell->GetFace(j);
+ if ( !myShowInside ) {
+ input->GetCellNeighbors(cellId, face->PointIds, cellIds);
+ nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
+ }
+#ifdef SHOW_COINCIDING_3D_PAL21924
+ bool process = nbNeighbors <= 0;
+#else
+ bool process = nbNeighbors <= 0 || GetAppendCoincident3D();
+#endif
+ if ( process || myShowInside ) {
+ face->Triangulate(0,lpts,coords);
+ for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
+ aNewPts[0] = lpts->GetId(i);
+ aNewPts[1] = lpts->GetId(i+1);
+ aNewPts[2] = lpts->GetId(i+2);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ }
+ } //3d nonlinear cell
+ cellIds->Delete();
+ coords->Delete();
+ lpts->Delete();
+ break;
+ }
+ else { // wireframe
+ switch(aCellType) {
+ case VTK_QUADRATIC_EDGE:
+ {
+ vtkIdType arcResult =-1;
+ if(myIsBuildArc) {
+ arcResult = Build1DArc(cellId, input, output, pts,myMaxArcAngle);
+ newCellId = arcResult;
+ }
+ if(!myIsBuildArc || arcResult == -1) {
+ aCellType = VTK_POLY_LINE;
+ numFacePts = 3;
+
+ aNewPts[0] = pts[0];
+ aNewPts[2] = pts[1];
+ aNewPts[1] = pts[2];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ }
+
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+ }
+ case VTK_QUADRATIC_TRIANGLE:
+ case VTK_BIQUADRATIC_TRIANGLE:
+ {
+ if(!myIsBuildArc) {
+ aCellType = VTK_POLYGON;
+ numFacePts = 6;
+
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[3];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[4];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[5];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ else
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
+ break;
+ }
+ case VTK_QUADRATIC_QUAD:
+ case VTK_BIQUADRATIC_QUAD:
+ {
+ if(!myIsBuildArc) {
+ aCellType = VTK_POLYGON;
+ numFacePts = 8;
+
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[4];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[5];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[6];
+ aNewPts[6] = pts[3];
+ aNewPts[7] = pts[7];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ else
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
+ break;
+ }
+ case VTK_QUADRATIC_POLYGON:
+ {
+ if(!myIsBuildArc)
+ {
+ aCellType = VTK_POLYGON;
+
+ for ( i = 0; i < npts/2; ++i )
+ {
+ aNewPts[i*2 ] = pts[i];
+ aNewPts[i*2+1] = pts[i+npts/2];
+ }
+ newCellId = output->InsertNextCell(aCellType,npts,aNewPts);
+ if(myStoreMapping)
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ else
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
+ break;
+ }
+ case VTK_QUADRATIC_TETRA:
+ case VTK_QUADRATIC_WEDGE:
+ case VTK_TRIQUADRATIC_HEXAHEDRON:
+ 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);
+ }
+ }
+ }
+ }
+ }
+ break;
+ } // case of volumes in wireframe
+ } // switch by quadratic type
+ } // end WIREFRAME
+ break;
+ } //switch by type
+
+ } //if visible
+ } //for all cells