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

Method ClipPolyData

Filters/General/vtkTableBasedClipDataSet.cxx:1448–1475  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1446
1447//------------------------------------------------------------------------------
1448void vtkTableBasedClipDataSet::ClipPolyData(vtkPolyData* inputGrid,
1449 vtkImplicitFunction* implicitFunction, vtkDoubleArray* scalars, double isoValue,
1450 vtkUnstructuredGrid* outputUG)
1451{
1452 // check if it's easily convertible to vtkUnstructuredGrid
1453 auto polyData = vtkPolyData::SafeDownCast(inputGrid);
1454 if (vtkPolyDataToUnstructuredGrid::CanBeProcessedFast(polyData))
1455 {
1456 // convert to vtkUnstructuredGrid
1457 //
1458 // It's beneficial to convert a polydata to unstructured grid for clipping because the
1459 // GetCellType and GetCellPoints are the most expensive functions used (excluding point/cell
1460 // data related functions). The vtkPolyData ones are more expensive than the vtkUnstructuredGrid
1461 // ones because they perform a bit operation to get the cell type and then based on that, get
1462 // the correct cell array and extract the cell points. This overhead turns out to increase the
1463 // execution time by 10%-20%.
1464 vtkNew<vtkPolyDataToUnstructuredGrid> converter;
1465 converter->SetInputData(polyData);
1466 converter->SetContainerAlgorithm(this);
1467 converter->Update();
1468 auto uGrid = converter->GetOutput();
1469 this->ClipTDataSet(uGrid, implicitFunction, scalars, isoValue, outputUG);
1470 }
1471 else
1472 {
1473 this->ClipTDataSet(inputGrid, implicitFunction, scalars, isoValue, outputUG);
1474 }
1475}
1476
1477//------------------------------------------------------------------------------
1478template <class TGrid>

Callers 1

RequestDataMethod · 0.95

Calls 4

ClipTDataSetMethod · 0.95
SetInputDataMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected