MCPcopy Create free account
hub / github.com/Kitware/VTK / SplitCell

Method SplitCell

Filters/Geometry/vtkProjectSphereFilter.cxx:447–481  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

445
446//------------------------------------------------------------------------------
447void vtkProjectSphereFilter::SplitCell(vtkPointSet* input, vtkPointSet* output,
448 vtkIdType inputCellId, vtkIncrementalPointLocator* locator, vtkCellArray* connectivity,
449 int splitSide)
450{
451 // i screw up the canonical ordering of the cell but apparently this
452 // gets fixed by vtkCell::Clip().
453 vtkCell* cell = input->GetCell(inputCellId);
454 vtkNew<vtkDoubleArray> cellScalars;
455 cellScalars->SetNumberOfTuples(cell->GetNumberOfPoints());
456 double coord[3];
457 for (vtkIdType pt = 0; pt < cell->GetNumberOfPoints(); pt++)
458 {
459 output->GetPoint(cell->GetPointId(pt), coord);
460 if (splitSide == 0 && coord[0] > this->SplitLongitude + 180.)
461 {
462 coord[0] -= 360.;
463 }
464 else if (splitSide == 1 && coord[0] < this->SplitLongitude + 180.)
465 {
466 coord[0] += 360.;
467 }
468 cellScalars->SetValue(pt, coord[0]);
469 cell->GetPoints()->SetPoint(pt, coord);
470 }
471 vtkIdType numberOfCells = output->GetNumberOfCells();
472 double splitLocation = (splitSide == 0 ? -180. : 180.);
473 cell->Clip(splitLocation, cellScalars.GetPointer(), locator, connectivity, output->GetPointData(),
474 output->GetPointData(), input->GetCellData(), inputCellId, output->GetCellData(), splitSide);
475 // if the grid was an unstructured grid we have to update the cell
476 // types and locations for the created cells.
477 if (vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast(output))
478 {
479 this->SetCellInformation(ugrid, cell, output->GetNumberOfCells() - numberOfCells);
480 }
481}
482
483//------------------------------------------------------------------------------
484void vtkProjectSphereFilter::SetCellInformation(

Callers 1

Calls 14

SetCellInformationMethod · 0.95
GetCellMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45
GetPointIdMethod · 0.45
SetValueMethod · 0.45
SetPointMethod · 0.45
GetPointsMethod · 0.45
GetNumberOfCellsMethod · 0.45
ClipMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected