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

Method FindPointsWithinRadius

Common/DataModel/vtkStaticPointLocator2D.cxx:963–1010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961// touch.
962template <typename TIds>
963void BucketList2D<TIds>::FindPointsWithinRadius(double R, const double x[3], vtkIdList* result)
964{
965 double dist2;
966 double pt[3];
967 vtkIdType ptId, cno, numIds;
968 double R2 = R * R;
969 const vtkLocatorTuple<TIds>* ids;
970 double xMin[2], xMax[2];
971 int i, j, ii, jOffset, ijMin[2], ijMax[2];
972
973 // Determine the range of indices in each direction based on radius R
974 xMin[0] = x[0] - R;
975 xMin[1] = x[1] - R;
976 xMax[0] = x[0] + R;
977 xMax[1] = x[1] + R;
978
979 // Find the footprint in the locator
980 this->GetBucketIndices(xMin, ijMin);
981 this->GetBucketIndices(xMax, ijMax);
982
983 // Clear out previous results
984 result->Reset();
985
986 // Add points within footprint and radius
987 for (j = ijMin[1]; j <= ijMax[1]; ++j)
988 {
989 jOffset = j * this->xD;
990 for (i = ijMin[0]; i <= ijMax[0]; ++i)
991 {
992 cno = i + jOffset;
993
994 if ((numIds = this->GetNumberOfIds(cno)) > 0)
995 {
996 ids = this->GetIds(cno);
997 for (ii = 0; ii < numIds; ii++)
998 {
999 ptId = ids[ii].PtId;
1000 this->DataSet->GetPoint(ptId, pt);
1001 dist2 = Distance2BetweenPoints2D(x, pt);
1002 if (dist2 <= R2)
1003 {
1004 result->InsertNextId(ptId);
1005 }
1006 } // for all points in bucket
1007 } // if points in bucket
1008 } // i-footprint
1009 } // j-footprint
1010}
1011
1012//------------------------------------------------------------------------------
1013// Find the point within tol of the finite line, and closest to the starting

Callers

nothing calls this directly

Calls 7

GetNumberOfIdsMethod · 0.95
GetIdsMethod · 0.95
BuildLocatorMethod · 0.95
InsertNextIdMethod · 0.80
GetBucketIndicesMethod · 0.45
ResetMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected