Skip to content

Make vector projections independent of direction scale - #242

Open
xiehuanyi wants to merge 1 commit into
rai-opensource:masterfrom
xiehuanyi:fix-vector-projection-scale
Open

xiehuanyi wants to merge 1 commit into
rai-opensource:masterfrom
xiehuanyi:fix-vector-projection-scale

Conversation

@xiehuanyi

Copy link
Copy Markdown

project(v1, v2) currently multiplies by dot(v1, v2) without dividing by dot(v2, v2). As a result, projecting [3,1,4] onto [2,2,0] returns [16,16,0] instead of [2,2,0]; orthogonalize() then produces a vector that is not perpendicular to its reference direction. List/tuple direction inputs also raise TypeError.

Convert the documented array-like arguments to vectors and compute the full projection formula. Rescale the direction before dot products so very small/large directions do not underflow/overflow. Keep the historical zero-direction result.

Validation: two regressions fail before the fix; the zero-direction control passes. Tests cover signed/scaled directions, list/tuple inputs, scales1e-200 and1e200, and normalized/unnormalized perpendicular results. All184 base+pose3d tests pass with1 skip and8 existing warnings; repository-pinned Black23.10.0 and git diff --check pass.

Prepared with AI assistance.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants