| 1388 | //------------------------------------------------------------------------------ |
| 1389 | |
| 1390 | int vtkIntersectionPolyDataFilter::Impl ::GetSingleLoop(vtkPolyData* pd, simPolygon* loop, |
| 1391 | vtkIdType nextCell, std::vector<bool>& interPtBool, std::vector<bool>& lineBool) |
| 1392 | { |
| 1393 | int intertype = 0; |
| 1394 | vtkSmartPointer<vtkIdList> pointCells = vtkSmartPointer<vtkIdList>::New(); |
| 1395 | vtkSmartPointer<vtkIdList> cellPoints = vtkSmartPointer<vtkIdList>::New(); |
| 1396 | |
| 1397 | // Set up next and next cell values |
| 1398 | vtkIdType nextPt = loop->points.front().id; |
| 1399 | vtkIdType startPt = nextPt; |
| 1400 | interPtBool[nextPt] = true; |
| 1401 | pd->GetCellPoints(nextCell, cellPoints); |
| 1402 | |
| 1403 | simPoint newpoint; |
| 1404 | vtkIdType prevPt = nextPt; |
| 1405 | // Find next point by following line and choosing point that is not already |
| 1406 | // being used |
| 1407 | if (cellPoints->GetId(0) == nextPt) |
| 1408 | { |
| 1409 | newpoint.id = cellPoints->GetId(1); |
| 1410 | nextPt = cellPoints->GetId(1); |
| 1411 | } |
| 1412 | else |
| 1413 | { |
| 1414 | newpoint.id = cellPoints->GetId(0); |
| 1415 | nextPt = cellPoints->GetId(0); |
| 1416 | } |
| 1417 | pd->GetPoint(newpoint.id, newpoint.pt); |
| 1418 | loop->points.push_back(newpoint); |
| 1419 | interPtBool[nextPt] = true; |
| 1420 | |
| 1421 | // Loop until we get back to the point we started at, completing the loop! |
| 1422 | while (nextPt != startPt) |
| 1423 | { |
| 1424 | pd->GetPointCells(nextPt, pointCells); |
| 1425 | // There are multiple lines attached to this point; must figure out |
| 1426 | // the correct way to go |
| 1427 | if (pointCells->GetNumberOfIds() > 2) |
| 1428 | { |
| 1429 | // This is the first intersection. Find line of minimum angle and |
| 1430 | // set the orientation of the loop (i.e. CW or CCW) |
| 1431 | if (intertype == 0) |
| 1432 | { |
| 1433 | this->SetLoopOrientation(pd, loop, &nextCell, nextPt, prevPt, pointCells); |
| 1434 | intertype = 1; |
| 1435 | } |
| 1436 | // This is not the first intersection. Follow line that continues along |
| 1437 | // the set loop orientation |
| 1438 | else |
| 1439 | { |
| 1440 | if (this->FollowLoopOrientation(pd, loop, &nextCell, nextPt, prevPt, pointCells) != 1) |
| 1441 | { |
| 1442 | return 0; |
| 1443 | } |
| 1444 | } |
| 1445 | } |
| 1446 | // There is one line attached to point. This means the intersection has |
| 1447 | // an open intersection loop (i.e. the surfaces are open and one does not |
no test coverage detected