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

Method RequestData

Filters/Modeling/vtkSelectPolyData.cxx:257–395  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

255
256//------------------------------------------------------------------------------
257int vtkSelectPolyData::RequestData(vtkInformation* vtkNotUsed(request),
258 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
259{
260 // get the input and output objects
261 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
262 vtkInformation* outInfo = outputVector->GetInformationObject(0);
263 vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
264 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
265
266 // Initialize and check data
267 vtkDebugMacro(<< "Selecting data...");
268
269 this->GetUnselectedOutput()->Initialize();
270 this->GetSelectionEdges()->Initialize();
271
272 // CHeck if inputs are valid
273 if (input->GetNumberOfPoints() < 1)
274 {
275 vtkErrorMacro("Input contains no points");
276 return 1;
277 }
278 vtkIdType numLoopPts;
279 if (this->Loop == nullptr || (numLoopPts = this->Loop->GetNumberOfPoints()) < 3)
280 {
281 vtkErrorMacro("Please define a loop with at least three points");
282 return 1;
283 }
284
285 // Convert to triangle mesh. All further computations are done on the triangulated mesh.
286 vtkSmartPointer<vtkPolyData> triMesh;
287 {
288 vtkNew<vtkTriangleFilter> tf;
289 tf->SetInputData(input);
290 tf->PassLinesOff();
291 tf->PassVertsOff();
292 tf->SetContainerAlgorithm(this);
293 tf->Update();
294 triMesh = tf->GetOutput();
295 }
296 vtkCellArray* inPolys = triMesh->GetPolys();
297 if (inPolys->GetNumberOfCells() < 1)
298 {
299 vtkErrorMacro("This filter operates on surface primitives");
300 return 1;
301 }
302
303 // Create a mesh that only contains points and polys
304 // (probably to avoid potential interference of other cell types)
305 // and links are computed (so that neighbors can be retrieved).
306 vtkNew<vtkPolyData> mesh;
307 vtkPoints* inPts = triMesh->GetPoints();
308 mesh->SetPoints(inPts);
309 mesh->SetPolys(inPolys);
310 mesh->BuildLinks(); // to do neighborhood searching
311 vtkIdType numCells = mesh->GetNumberOfCells();
312
313 // Get a list of point IDs of the mesh that forms a continuous closed loop
314 vtkNew<vtkIdList> edgePointIds;

Callers

nothing calls this directly

Calls 15

GetUnselectedOutputMethod · 0.95
GetSelectionEdgesMethod · 0.95
GreedyEdgeSearchMethod · 0.95
DijkstraEdgeSearchMethod · 0.95
GetClosestCellIdMethod · 0.95
FillMarksInRegionMethod · 0.95
GetInformationObjectMethod · 0.80
GetPolysMethod · 0.80
SetPolysMethod · 0.80

Tested by

no test coverage detected