A robot point-cloud operation may request the nearest ten points or all points within a specified distance. Both sound like ways to select a local neighborhood, but they hold different properties fixed. A fixed count can expand across a sparse region, while a fixed radius can return too few points for a downstream calculation.

The distinction is about the data selected before fitting, smoothing, or describing geometry. A faster search structure does not remove it. The original examples below use exact distances in invented point arrangements and do not report an executed point-cloud pipeline.

Define the two selection questions

For a query location q, a k-nearest-neighbor search selects points with the smallest distances to q, up to the available count. Specifying k alone does not impose a maximum physical distance.

A radius search instead asks which points lie within a specified distance r of q. Without a separate result cap, the number returned depends on the point arrangement. Specifying r alone does not guarantee a minimum count.

Point Cloud Library's KdTree tutorial demonstrates both forms of search. Its search-class reference separately documents the requested neighbor count, radius, returned count, and squared-distance outputs. The distinctions motivate the calculations here; the tutorial's random cloud and demonstration values are not reused.

An exact one-dimensional neighborhood

Place a query at the origin on a line. The cloud contains points at distances 0.010, 0.020, 0.030, 0.040, 0.100, and 0.200 meter along the positive axis. Assume these are the only points and that the query itself is not a stored cloud point.

Request k = 4. The returned points reach out to 0.040 meter. Request a radius of 0.035 meter instead, and only the first three points qualify. The nearest four and the radius-limited neighborhood differ even though they use the same distance metric and query.

Now remove the points at 0.020 and 0.030 meter while retaining all others. The nearest-four request reaches 0.200 meter, five times the former outer distance. The radius request still reaches no farther than 0.035 meter but returns only one point.

The first selector preserved count by enlarging physical support. The second preserved the distance limit by accepting a smaller count. Neither outcome proves that the retained points describe one physical surface or contain enough independent geometric information.

Count and span are separate metadata

An algorithm supplied with four points in both clouds might appear to have unchanged input size. It has actually received measurements over substantially different spatial extents. A local plane assumption or another geometric model can have different meaning over those extents.

Conversely, two neighborhoods with the same radius can contain very different point counts. A downstream method expecting several nondegenerate measurements must check the returned data, rather than assuming that a distance threshold supplied them.

Repeated points create another distinction. Four records at almost the same location can satisfy a count request while adding little geometric spread. Neighbor count is not automatically the number of independently informative directions or surfaces.

How density changes a typical physical scale

For a separate approximate model, imagine points spread uniformly over a locally flat surface with areal density rho points per square meter. Ignore boundaries and curvature, and treat rho × pi × r² as the expected count inside radius r. This is a continuous density approximation, not an exact statement for every finite cloud.

At rho = 10,000 points per square meter and r = 0.030 meter, the expected count is approximately 28.27. Reducing density to 2,500 while preserving the radius reduces that expectation to approximately 7.07.

Invert the same approximate relationship to associate a scale with k = 20: r is approximately sqrt[k/(pi rho)]. At the first density that scale is about 0.02523 meter; at the second it is about 0.05046 meter.

Reducing areal density by a factor of four doubled the approximate radius needed to collect the same count. It did not multiply that radius by four. This square-root relationship follows from the assumed two-dimensional surface area; a line or a volumetric distribution would have a different scaling law.

A combined count and radius condition has an explicit failure case

An application can require at most four nearest points and reject any farther than 0.035 meter. In the original line cloud, that combination yields three acceptable points. In the reduced cloud, it yields one.

The combined rule prevents the selector from reaching arbitrarily far merely to fill a count, but it must allow an insufficient-neighborhood outcome. Replacing that outcome with invented points or silently expanding the radius would change the stated rule.

Point Cloud Library's radius-search interface also permits a maximum returned count. The precise interface, search configuration, and returned distances still need to be checked when translating an application rule into software. No library behavior beyond the documented contract is assumed here.

Keep distance units and query membership explicit

The cited PCL interfaces describe squared distances in their result arrays. A physical radius of 0.030 meter corresponds to 0.0009 square meter. Comparing a squared distance directly with 0.030 would mix units and implement a different threshold.

The query may also be a member of the input cloud. Its zero-distance self-match can occupy one returned position, depending on the search setup. The exact line examples excluded that case explicitly so that four meant four other stored points.

Ties, invalid points, result caps, and approximate-search settings can affect a concrete implementation. The mathematical lesson survives those details: count and physical support answer different questions. Recording both the requested selector and the actual returned count and extent makes a neighborhood-based robot perception result easier to interpret.

Sources checked October 23, 2026

Point Cloud Library, How to use a KdTree to search, documentation displayed as 1.15.1-dev:

https://pointclouds.org/documentation/tutorials/kdtree_search.html

Point Cloud Library, pcl::search::KdTree class reference, nearestKSearch and radiusSearch:

https://pointclouds.org/documentation/classpcl_1_1search_1_1_kd_tree.html

All point locations, densities, counts, and calculations are original hypothetical examples. No source arrays, figures, or software output are reproduced.

Illustration note: The accompanying robot sensing scene is a generic concept illustration. It does not show a measured point cloud, an executed neighbor search, or validated perception accuracy.