fix: infer default normals in vector angle helpers - #906
Conversation
|
Thanks for the report and the patch. I reviewed this and reproduced your validation locally on a checkout of the PR head ( Verification
One optional suggestionWhen the normal is inferred from (Also noting for context that the Copilot review on this PR never ran — it reported a quota limit.) |
iory
left a comment
There was a problem hiding this comment.
Approving: verified locally as described above. The 10 new cases fail on the pre-fix math.py and the full tests/skrobot_tests/coordinates_tests suite passes (147) with the fix, lint is clean, and the explicit-normal path is unchanged. Will merge once CI is green.
Fixes #905.
Both oriented-angle helpers accept
normal_vector=None, but their default branches call the parameter itself, raisingTypeError: 'NoneType' object is not callable.Use the existing
normalize_vectorhelper on the cross product, and document how the default normal is inferred. For[1, 0, 0]and[0, 1, 0], the functions now return pi/2 counter-clockwise and 3*pi/2 clockwise. Explicit normals retain their existing behavior.Validation:
.venv/bin/python -m pytest tests/skrobot_tests/coordinates_tests -q: 147 passed.[2, 0, 0]/[3, 3, 0]verifies that the cross product is normalized, rather than merely avoiding the exception.git diff --checkpass on the changed files.Tested with Python 3.13.15, NumPy 2.5.3 and SciPy 1.18.1 on macOS. The robot, renderer and simulator test suites were not run for this coordinates-only fix.