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

Method GatherPoints

Common/DataModel/vtkStaticPointLocator.cxx:854–890  ·  view source on GitHub ↗

Gather nearby points in the bin binIdx. Initially, we gather N points in order to define the sphere S with center x and radius**2 maxR2. Then, after N points are defined, switch the gathering mode to all points in S (inclusive). Points are placed into the res results vector, maxR2 is updated and returned.

Source from the content-addressed store, hash-verified

852 // in S (inclusive). Points are placed into the res results vector, maxR2
853 // is updated and returned.
854 double GatherPoints(int i, int j, int k, vtkIdType binIdx, int level, int N, double minR2,
855 double maxR2, vtkDist2TupleArray& res)
856 {
857 bool gathering = true;
858
859 vtkIdType numIds = this->Bins->GetNumberOfIds(binIdx);
860 if (numIds <= 0 || this->CanCullBin(gathering, minR2, maxR2, i, j, k, level))
861 {
862 return maxR2;
863 }
864
865 const vtkLocatorTuple<TIds>* ids = this->Bins->GetIds(binIdx);
866 double* pt;
867 for (vtkIdType ii = 0; ii < numIds; ++ii)
868 {
869 vtkIdType ptId = ids[ii].PtId;
870 pt = this->GetPoint(ptId);
871 double d2 = vtkMath::Distance2BetweenPoints(this->X, pt);
872 if (d2 > minR2) // not culled by minimum shell radius
873 {
874 // If not yet gathered N points, maxR2 may still be increasing
875 if (static_cast<int>(res.size()) < N)
876 {
877 res.emplace_back(ptId, d2);
878 maxR2 = (d2 > maxR2 ? d2 : maxR2);
879 }
880 // maxR2 is determined, so gather points in sphere
881 else if (d2 <= maxR2)
882 {
883 gathering = false;
884 res.emplace_back(ptId, d2);
885 }
886 } // if potential candidate
887 } // for all points in this bin
888
889 return maxR2;
890 }
891
892 // Add points in the bin binIdx. Like GatherPoints(), except at this point
893 // maxR2 has been determined. Also will cull entire bins if they are not

Callers 1

FindNPointsInShellMethod · 0.45

Calls 6

CanCullBinMethod · 0.95
GetPointMethod · 0.95
GetNumberOfIdsMethod · 0.45
GetIdsMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected