Return true if the bin can be culled: if the bin specified by (i,j,k) is completely outside of the shell request; and completely outside any of the optional sphere petals, then the bin can be eliminated from further processing. Otherwise, false is returned.
| 803 | // outside any of the optional sphere petals, then the bin can be |
| 804 | // eliminated from further processing. Otherwise, false is returned. |
| 805 | bool CanCullBin(bool gathering, double minR2, double maxR2, int i, int j, int k, int level) |
| 806 | { |
| 807 | // Bin culling is generally not worth it for smaller levels. |
| 808 | if (level < this->LEVEL_QUERY_THRESHOLD || gathering) |
| 809 | { |
| 810 | return false; |
| 811 | } |
| 812 | |
| 813 | // Obtain the bucket bounding box |
| 814 | double min[3], max[3]; |
| 815 | this->Bins->GetBucketBounds(i, j, k, min, max); |
| 816 | |
| 817 | // Cull the bin if fully outside the (minR2,maxR2] footprint. |
| 818 | // Greater than the shell request outer radius, and maxR2 determined. |
| 819 | if (!vtkBoundingBox::IntersectsSphere(min, max, this->X, maxR2)) |
| 820 | { |
| 821 | return true; |
| 822 | } |
| 823 | |
| 824 | // Strictly less than the shell request inner radius, minR2 is always known. |
| 825 | if (vtkBoundingBox::InsideSphere(min, max, this->X, minR2)) |
| 826 | { |
| 827 | return true; |
| 828 | } |
| 829 | |
| 830 | // At this point, the bin overlaps the shell request. Cull the bin if not |
| 831 | // in any of the provided Voronoi hull spheres (petals). |
| 832 | if (this->NumSpheres > 0) |
| 833 | { |
| 834 | const double* sphere = this->Spheres; |
| 835 | for (int sNum = 0; sNum < this->NumSpheres; ++sNum, sphere += 4) |
| 836 | { |
| 837 | if (vtkBoundingBox::IntersectsSphere(min, max, sphere, sphere[3])) |
| 838 | { |
| 839 | return false; |
| 840 | } |
| 841 | } |
| 842 | return true; // not in any Voronoi flower petal |
| 843 | } |
| 844 | |
| 845 | // The bin cannot be culled. |
| 846 | return false; |
| 847 | } |
| 848 | |
| 849 | // Gather nearby points in the bin binIdx. Initially, we gather N points |
| 850 | // in order to define the sphere S with center x and radius**2 maxR2. |
no test coverage detected