Gather nearby points in the bin binIdx. Initially, we gather N points in order to define the circle S with center x and radius**2 maxR2. Then, after N points are defined, switch the gathering mode to all points in the circle (inclusive). Points are placed into the results vector, maxR2 is updated and returned.
| 777 | // in the circle (inclusive). Points are placed into the results vector, |
| 778 | // maxR2 is updated and returned. |
| 779 | double GatherPoints(int i, int j, vtkIdType binIdx, int level, int N, double minR2, double maxR2, |
| 780 | vtkDist2TupleArray& res) |
| 781 | { |
| 782 | bool gathering = true; |
| 783 | |
| 784 | vtkIdType numIds = this->Bins->GetNumberOfIds(binIdx); |
| 785 | if (numIds <= 0 || this->CanCullBin(gathering, minR2, maxR2, i, j, level)) |
| 786 | { |
| 787 | return maxR2; |
| 788 | } |
| 789 | |
| 790 | const vtkLocatorTuple<TIds>* ids = this->Bins->GetIds(binIdx); |
| 791 | double* pt; |
| 792 | for (vtkIdType ii = 0; ii < numIds; ++ii) |
| 793 | { |
| 794 | vtkIdType ptId = ids[ii].PtId; |
| 795 | pt = this->GetPoint(ptId); |
| 796 | double d2 = Distance2BetweenPoints2D(this->X, pt); |
| 797 | if (d2 > minR2) // not culled by minimum annulus radius |
| 798 | { |
| 799 | // If not yet found N points, maxR2 may still be increasing |
| 800 | if (static_cast<int>(res.size()) < N) |
| 801 | { |
| 802 | res.emplace_back(vtkDist2Tuple(ptId, d2)); |
| 803 | maxR2 = (d2 > maxR2 ? d2 : maxR2); |
| 804 | } |
| 805 | // maxR2 is determined, so gather points in circle |
| 806 | else if (d2 <= maxR2) |
| 807 | { |
| 808 | gathering = false; |
| 809 | res.emplace_back(vtkDist2Tuple(ptId, d2)); |
| 810 | } |
| 811 | } // if potential candidate |
| 812 | } // for all points in this bin |
| 813 | |
| 814 | return maxR2; |
| 815 | } |
| 816 | |
| 817 | // Add points in the bin binIdx. Like GatherPoints(), except at this point |
| 818 | // maxR2 has been determined. Also will cull entire bins if they are not |
no test coverage detected