------------------------------------------------------------------------------
| 752 | |
| 753 | //------------------------------------------------------------------------------ |
| 754 | void vtkPointLocator::FindPointsWithinRadius(double R, const double x[3], vtkIdList* result) |
| 755 | { |
| 756 | this->BuildLocator(); |
| 757 | if (this->HashTable == nullptr) |
| 758 | { |
| 759 | return; |
| 760 | } |
| 761 | int i, j; |
| 762 | double dist2; |
| 763 | double pt[3]; |
| 764 | vtkIdType ptId, nids, cno; |
| 765 | vtkIdList* ptIds; |
| 766 | int ijk[3], *nei; |
| 767 | double R2 = R * R; |
| 768 | vtkNeighborPoints buckets; |
| 769 | |
| 770 | // Find bucket point is in. |
| 771 | this->GetBucketIndices(x, ijk); |
| 772 | |
| 773 | // get all buckets within a distance |
| 774 | this->GetOverlappingBuckets(&buckets, x, ijk, R, 0); |
| 775 | // add the original bucket |
| 776 | buckets.InsertNextPoint(ijk); |
| 777 | |
| 778 | // clear out the result |
| 779 | result->Reset(); |
| 780 | |
| 781 | for (i = 0; i < buckets.GetNumberOfNeighbors(); i++) |
| 782 | { |
| 783 | nei = buckets.GetPoint(i); |
| 784 | cno = nei[0] + nei[1] * this->XD + nei[2] * this->SliceSize; |
| 785 | |
| 786 | if ((ptIds = this->HashTable[cno]) != nullptr) |
| 787 | { |
| 788 | nids = ptIds->GetNumberOfIds(); |
| 789 | for (j = 0; j < nids; j++) |
| 790 | { |
| 791 | ptId = ptIds->GetId(j); |
| 792 | this->DataSet->GetPoint(ptId, pt); |
| 793 | dist2 = vtkMath::Distance2BetweenPoints(x, pt); |
| 794 | if (dist2 <= R2) |
| 795 | { |
| 796 | result->InsertNextId(ptId); |
| 797 | } |
| 798 | } |
| 799 | } |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | //------------------------------------------------------------------------------ |
| 804 | void vtkPointLocator::BuildLocator() |
nothing calls this directly
no test coverage detected