------------------------------------------------------------------------------
| 511 | |
| 512 | //------------------------------------------------------------------------------ |
| 513 | bool vtkHyperTreeGridPlaneCutter::RecursivelyPreProcessTree( |
| 514 | vtkHyperTreeGridNonOrientedGeometryCursor* cursor) |
| 515 | { |
| 516 | // If cursor is at a masked cell stop recursion |
| 517 | vtkIdType id = cursor->GetGlobalNodeIndex(); |
| 518 | if (this->InMask && this->InMask->GetValue(id)) |
| 519 | { |
| 520 | return false; |
| 521 | } |
| 522 | |
| 523 | // A node is not selected until proven otherwise |
| 524 | bool selected = false; |
| 525 | |
| 526 | // Retrieve cursor geometry |
| 527 | double* origin = cursor->GetOrigin(); |
| 528 | double* size = cursor->GetSize(); |
| 529 | |
| 530 | // Initialize cell coordinates |
| 531 | double cellCoords[8][3]; |
| 532 | for (int i = 0; i < 8; ++i) |
| 533 | { |
| 534 | cellCoords[i][0] = (i & 1) ? origin[0] + size[0] : origin[0]; |
| 535 | cellCoords[i][1] = (i & 2) ? origin[1] + size[1] : origin[1]; |
| 536 | cellCoords[i][2] = (i & 4) ? origin[2] + size[2] : origin[2]; |
| 537 | } |
| 538 | |
| 539 | // Check cell-plane intersection |
| 540 | if (this->CheckIntersection(cellCoords)) |
| 541 | { |
| 542 | // Selected this node |
| 543 | if (cursor->IsLeaf()) |
| 544 | { |
| 545 | selected = true; |
| 546 | } // if ( cursor->IsLeaf() ) |
| 547 | else |
| 548 | { |
| 549 | // Cursor is not at leaf, recurse to all children |
| 550 | int numChildren = cursor->GetNumberOfChildren(); |
| 551 | for (int ichild = 0; ichild < numChildren; ++ichild) |
| 552 | { |
| 553 | if (this->CheckAbort()) |
| 554 | { |
| 555 | break; |
| 556 | } |
| 557 | cursor->ToChild(ichild); |
| 558 | // Recurse and keep track of whether this branch is selected |
| 559 | selected |= this->RecursivelyPreProcessTree(cursor); |
| 560 | cursor->ToParent(); |
| 561 | } // ichild |
| 562 | } // else |
| 563 | } // if ( this->CheckIntersection ) |
| 564 | |
| 565 | // Update list of selected cells |
| 566 | this->SelectedCells->SetTuple1(id, selected); |
| 567 | |
| 568 | // Return whether current node was selected |
| 569 | return selected; |
| 570 | } |
no test coverage detected