Return the next bin in the iteration sequence over the shell at the current level. Also returns the (i,j,k) of the bin.
| 754 | // Return the next bin in the iteration sequence over the shell at the |
| 755 | // current level. Also returns the (i,j,k) of the bin. |
| 756 | vtkIdType NextBin(int& i, int& j, int& k) |
| 757 | { |
| 758 | // There is no next bin at level 0 |
| 759 | if (this->Level <= 0) |
| 760 | { |
| 761 | i = j = k = (-1); |
| 762 | return (-1); |
| 763 | } |
| 764 | |
| 765 | // Begin iteration until a bin on the shell is discovered. Note that |
| 766 | // I,J,K should have been previously set. However, we need to move to the |
| 767 | // next possible bin, meaning incrementing I,J,K. |
| 768 | while (this->K <= this->Max[2]) |
| 769 | { |
| 770 | // Forward increment |
| 771 | this->I++; |
| 772 | if (this->I > this->Max[0]) |
| 773 | { |
| 774 | this->I = this->Min[0]; |
| 775 | this->J++; |
| 776 | if (this->J > this->Max[1]) |
| 777 | { |
| 778 | this->J = this->Min[1]; |
| 779 | this->K++; |
| 780 | } |
| 781 | } |
| 782 | // Check if on shell boundary |
| 783 | if (this->K <= this->Max[2] && |
| 784 | (this->I == (this->Center[0] + this->Level) || this->I == (this->Center[0] - this->Level) || |
| 785 | this->J == (this->Center[1] + this->Level) || |
| 786 | this->J == (this->Center[1] - this->Level) || |
| 787 | this->K == (this->Center[2] + this->Level) || this->K == (this->Center[2] - this->Level))) |
| 788 | { |
| 789 | i = this->I; |
| 790 | j = this->J; |
| 791 | k = this->K; |
| 792 | return (this->I + (this->J * this->Divs[0]) + (this->K * this->Slice)); |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | // Completed traversal |
| 797 | i = j = k = (-1); |
| 798 | return (-1); |
| 799 | } |
| 800 | |
| 801 | // Return true if the bin can be culled: if the bin specified by |
| 802 | // (i,j,k) is completely outside of the shell request; and completely |