Function to find the regions on each input separated by the intersection lines
| 469 | // Function to find the regions on each input separated by the intersection |
| 470 | // lines |
| 471 | void vtkLoopBooleanPolyDataFilter::Impl::GetBooleanRegions( |
| 472 | int inputIndex, std::vector<simLoop>* loops) |
| 473 | { |
| 474 | vtkSmartPointer<vtkPolyData> tmpPolyData = vtkSmartPointer<vtkPolyData>::New(); |
| 475 | tmpPolyData->DeepCopy(this->Mesh[inputIndex]); |
| 476 | tmpPolyData->BuildLinks(); |
| 477 | |
| 478 | std::vector<simLoop>::iterator loopit; |
| 479 | std::list<simLine>::iterator cellit; |
| 480 | |
| 481 | // For each intersection loop |
| 482 | for (loopit = loops->begin(); loopit != loops->end(); ++loopit) |
| 483 | { |
| 484 | std::list<simLine> loopcells = (loopit)->cells; |
| 485 | // Go through each cell in the loop |
| 486 | for (cellit = loopcells.begin(); cellit != loopcells.end(); ++cellit) |
| 487 | { |
| 488 | simLine nextLine; |
| 489 | nextLine = *cellit; |
| 490 | vtkIdType nextCell = nextLine.id; |
| 491 | vtkIdType p1 = nextLine.pt1; |
| 492 | vtkIdType p2 = nextLine.pt2; |
| 493 | vtkIdType outputCellId0 = this->NewCellIds[inputIndex]->GetComponent(nextCell, 0); |
| 494 | vtkIdType outputCellId1 = this->NewCellIds[inputIndex]->GetComponent(nextCell, 1); |
| 495 | // If the cell has not been given an orientation from the flood fill |
| 496 | // algorithm and it has an id from vtkIntersectionPolyDataFilter |
| 497 | if (outputCellId0 != -1) |
| 498 | { |
| 499 | // If the cell hasn't been touched |
| 500 | if (this->CheckedCarefully[inputIndex][outputCellId0] == 0) |
| 501 | { |
| 502 | int sign1 = this->GetCellOrientation(tmpPolyData, outputCellId0, p1, p2, inputIndex); |
| 503 | // If cell orientation is found |
| 504 | if (sign1 != 0) |
| 505 | { |
| 506 | this->CheckCells->InsertNextId(outputCellId0); |
| 507 | this->FindRegion(inputIndex, sign1, 1, 1); |
| 508 | this->CheckCells->Reset(); |
| 509 | this->CheckCells2->Reset(); |
| 510 | this->CheckCellsCareful->Reset(); |
| 511 | this->CheckCellsCareful2->Reset(); |
| 512 | } |
| 513 | } |
| 514 | } |
| 515 | // Check cell on other side of intersection line |
| 516 | if (outputCellId1 != -1) |
| 517 | { |
| 518 | // If the cell hasn't been touched |
| 519 | if (this->CheckedCarefully[inputIndex][outputCellId1] == 0) |
| 520 | { |
| 521 | int sign2 = this->GetCellOrientation(tmpPolyData, outputCellId1, p1, p2, inputIndex); |
| 522 | // If cell orientation is found |
| 523 | if (sign2 != 0) |
| 524 | { |
| 525 | this->CheckCells->InsertNextId(outputCellId1); |
| 526 | this->FindRegion(inputIndex, sign2, 1, 1); |
| 527 | this->CheckCells->Reset(); |
| 528 | this->CheckCells2->Reset(); |
no test coverage detected