Simplify/robustify segment-point distance calculation. #24840
Merged
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.
The version in poly_editor is relatively simple because it only supports array inputs and doesn't vectorize over any input.
The version in proj3d is private so the API can be changed, but it needs (currently) to at least support non-array inputs and to vectorize over
p
.s0, s1
) and the "point" (p
) parameters clearer.p
to support (N, ndim) inputs instead of (ndim, N) (consistently with most other APIs); adjust test_lines_dists accordingly.p1, p2
would be silently ignored (because access was viap1[0]
,p1[1]
,p2[0]
,p2[1]
). Instead now the vectorized version naturally extends to any number of dimensions. Adjust format_coord and test_lines_dists_nowarning accordingly.s0
,s1
, if they have the same length asp
(this comes basically for free).PR Summary
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst