MCPcopy Create free account
hub / github.com/PDAL/PDAL / findNeighbors

Method findNeighbors

pdal/private/PointGrid.cpp:72–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72PointIdList PointGrid::findNeighbors(BOX2D extent) const
73{
74 extent.clip(bounds());
75
76 PointIdList neighbors;
77
78 // Find IJ bounding box.
79 auto [imin, jmin] = toIJ(extent.minx, extent.miny);
80 auto [imax, jmax] = toIJ(extent.maxx, extent.maxy);
81
82 for (uint16_t i = imin; i <= imax; ++i)
83 for (uint16_t j = jmin; j <= jmax; ++j)
84 {
85 const Cell& c = cell(i, j);
86
87 // If the entire cell is in the extent, append all points.
88 if (extent.contains(bounds(i, j)))
89 neighbors.insert(neighbors.end(), c.begin(), c.end());
90 // Otherwise, check each point to make sure it's in the xtent.
91 else
92 for (PointId id : c)
93 {
94 double x = m_view.getFieldAs<double>(Dimension::Id::X, id);
95 double y = m_view.getFieldAs<double>(Dimension::Id::Y, id);
96 if (extent.contains(x, y))
97 neighbors.push_back(id);
98 }
99 }
100 return neighbors;
101}
102
103PointIdList PointGrid::findNeighbors(PointRef& point, double radius) const
104{

Callers 6

doneMethod · 0.80
neighborsMethod · 0.80
knnSearchMethod · 0.80
neighborsMethod · 0.80
knnSearchMethod · 0.80
neighborsMethod · 0.80

Calls 6

boundsFunction · 0.50
containsMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
growMethod · 0.45

Tested by

no test coverage detected