Repository navigation
Conversation
Validate counts before selecting points and preserve empty results and existing valid sampling behavior.
Cover zero, invalid and NumPy integer counts, seeded ordering and duplicate input rows.
Document the integer count range, empty results, duplicate rows and invalid-count errors.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue
No matching open issue or competing fix found for the farthest-point sampler's count bounds.
What does this implement/fix?
farthest_point_samplingalways chooses its initial row before consideringn_points. With two input rows andn_points=3, all row indices eventually become selected and the loop never advances. Requesting zero points returns one row instead (or errors for an empty cloud).Validate the integer count before selecting the initial row. Counts outside
[0, M]raiseValueError, and a zero count returns an empty(0, N)array with the input dtype. The standard integer-index protocol also accepts NumPy integer scalars and rejects noninteger counts rather than silently sampling a rounded-up count. Document these boundaries in the function and existing official RST page.The sampling loop, valid-input random seeds/order, defaults, and other sampling algorithms are unchanged. Duplicate coordinates remain separate input rows and can each be selected at most once.
Additional information
Validation on Linux / Python 3.14.8 using the repository-pinned environment:
bash runtests.sh: 168 passed in 326.43 seconds, including code style and all configured mypy checks, with BLAS/OMP threads limited to one.git diff --check: passed; Ruff's existing configuration deprecation notice is unchanged.make -C docs html BUILDDIR=/tmp/pythonrobotics-fps-docs: passed with the existing-Wsetting. Generated HTML contains the new boundary and exception documentation and retains its mapping navigation link. The CircleCI documentation artifact was opened through its Mapping parent page and visually inspected in light theme. The new boundary paragraph, the Farthest Point Sampling illustration, and the API parameter, return-value, and exception sections rendered correctly. No hardware verification is claimed. This PR remains a draft; hosted CI approvals and completion are tracked separately.No dependency changes, GPU tests, or macOS/Windows runs. AI assistance was used for implementation and test preparation; no human review is claimed.
CheckList