------------------------------------------------------------------------------
| 482 | |
| 483 | //------------------------------------------------------------------------------ |
| 484 | void vtkProjectSphereFilter::SetCellInformation( |
| 485 | vtkUnstructuredGrid* output, vtkCell* cell, vtkIdType numberOfNewCells) |
| 486 | { |
| 487 | auto cellTypes = vtkUnsignedCharArray::FastDownCast(output->GetCellTypes()); |
| 488 | for (vtkIdType i = 0; i < numberOfNewCells; i++) |
| 489 | { |
| 490 | vtkIdType prevCellId = output->GetNumberOfCells() + i - numberOfNewCells - 1; |
| 491 | vtkIdType newCellId = prevCellId + 1; |
| 492 | vtkIdType numPts; |
| 493 | const vtkIdType* pts; |
| 494 | output->GetCells()->GetCellAtId(newCellId, numPts, pts); |
| 495 | if (cell->GetCellDimension() == 0) |
| 496 | { |
| 497 | if (numPts > 2) |
| 498 | { |
| 499 | cellTypes->InsertValue(newCellId, VTK_POLY_VERTEX); |
| 500 | } |
| 501 | else |
| 502 | { |
| 503 | vtkErrorMacro("Cannot handle 0D cell with " << numPts << " number of points."); |
| 504 | } |
| 505 | } |
| 506 | else if (cell->GetCellDimension() == 1) |
| 507 | { |
| 508 | if (numPts == 2) |
| 509 | { |
| 510 | cellTypes->InsertValue(newCellId, VTK_LINE); |
| 511 | } |
| 512 | else if (numPts > 2) |
| 513 | { |
| 514 | cellTypes->InsertValue(newCellId, VTK_POLY_LINE); |
| 515 | } |
| 516 | else |
| 517 | { |
| 518 | vtkErrorMacro("Cannot handle 1D cell with " << numPts << " number of points."); |
| 519 | } |
| 520 | } |
| 521 | else if (cell->GetCellDimension() == 2) |
| 522 | { |
| 523 | if (numPts == 3) |
| 524 | { |
| 525 | cellTypes->InsertValue(newCellId, VTK_TRIANGLE); |
| 526 | } |
| 527 | else if (numPts > 3 && cell->GetCellType() == VTK_TRIANGLE_STRIP) |
| 528 | { |
| 529 | cellTypes->InsertValue(newCellId, VTK_TRIANGLE_STRIP); |
| 530 | } |
| 531 | else if (numPts == 4) |
| 532 | { |
| 533 | cellTypes->InsertValue(newCellId, VTK_QUAD); |
| 534 | } |
| 535 | else |
| 536 | { |
| 537 | vtkErrorMacro("Cannot handle 2D cell with " << numPts << " number of points."); |
| 538 | } |
| 539 | } |
| 540 | else // 3D cell |
| 541 | { |
no test coverage detected