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

Method GetLoops

Filters/General/vtkIntersectionPolyDataFilter.cxx:1321–1386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1319}
1320
1321int vtkIntersectionPolyDataFilter::Impl ::GetLoops(vtkPolyData* pd, std::vector<simPolygon>* loops)
1322{
1323 vtkSmartPointer<vtkIdList> pointCells = vtkSmartPointer<vtkIdList>::New();
1324 vtkSmartPointer<vtkIdList> cellPoints = vtkSmartPointer<vtkIdList>::New();
1325 simPoint nextPt;
1326 vtkIdType nextCell;
1327
1328 int numPoints = pd->GetNumberOfPoints();
1329 int numCells = pd->GetNumberOfCells();
1330
1331 std::vector<bool> ptBool(numPoints, false);
1332 // Add one for the cell that could be added in GetSingleLoop
1333 std::vector<bool> lineBool(numCells + 1, false);
1334
1335 // For each point in triangle and additional lines
1336 for (vtkIdType ptId = 0; ptId < numPoints; ptId++)
1337 {
1338 // if the point hasn't already been touch and put in a loop
1339 if (!ptBool[ptId])
1340 {
1341 nextPt.id = ptId;
1342 pd->GetPoint(nextPt.id, nextPt.pt);
1343 simPolygon interloop;
1344 interloop.points.push_back(nextPt);
1345
1346 ptBool[nextPt.id] = true;
1347 pd->GetPointCells(nextPt.id, pointCells);
1348 nextCell = pointCells->GetId(0);
1349 lineBool[nextCell] = true;
1350
1351 // Get one loop for untouched point
1352 if (this->GetSingleLoop(pd, &interloop, nextCell, ptBool, lineBool) != 1)
1353 {
1354 return 0;
1355 }
1356 // Add new loop
1357 loops->push_back(interloop);
1358 }
1359 }
1360 // Check now for untouched lines, possible to still have
1361 for (vtkIdType lineId = 0; lineId < pd->GetNumberOfCells(); lineId++)
1362 {
1363 if (!lineBool[lineId])
1364 {
1365 vtkDebugWithObjectMacro(this->ParentFilter, << "LINE FALSE: Find extra loop/s");
1366 pd->GetCellPoints(lineId, cellPoints);
1367 nextPt.id = cellPoints->GetId(0);
1368 pd->GetPoint(nextPt.id, nextPt.pt);
1369 simPolygon interloop;
1370 interloop.points.push_back(nextPt);
1371
1372 lineBool[lineId] = true;
1373 nextCell = lineId;
1374
1375 // Get single loop if the line is still untouched
1376 if (this->GetSingleLoop(pd, &interloop, nextCell, ptBool, lineBool) != 1)
1377 {
1378 return 0;

Callers 1

SplitCellMethod · 0.95

Calls 9

GetSingleLoopMethod · 0.95
NewFunction · 0.50
GetNumberOfPointsMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetPointMethod · 0.45
push_backMethod · 0.45
GetPointCellsMethod · 0.45
GetIdMethod · 0.45
GetCellPointsMethod · 0.45

Tested by

no test coverage detected