MCPcopy Create free account
hub / github.com/Kitware/VTK / FindPointsWithinRadius

Method FindPointsWithinRadius

Common/DataModel/vtkPointLocator.cxx:754–801  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

752
753//------------------------------------------------------------------------------
754void 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//------------------------------------------------------------------------------
804void vtkPointLocator::BuildLocator()

Callers

nothing calls this directly

Calls 10

BuildLocatorMethod · 0.95
GetOverlappingBucketsMethod · 0.95
InsertNextIdMethod · 0.80
GetBucketIndicesMethod · 0.45
InsertNextPointMethod · 0.45
ResetMethod · 0.45
GetNumberOfNeighborsMethod · 0.45
GetPointMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected