Skip to content

Return finite closest points for parallel and coincident lines - #304

Open
kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-parallel-closest-nov14
Open

kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-parallel-closest-nov14

Conversation

@kaushikgunasekaren

Copy link
Copy Markdown

Bug

Line3.closest_to_line() divides by the squared cross-product norm even for parallel or coincident lines. Both the closest point and distance become NaN, including in sequence/broadcast queries.

Fix

Use the existing parallel predicate before that division. For parallel or coincident lines, return the first line's principal point as a representative closest point, together with the existing minimum-distance calculation. Document this choice; the closest point is not unique in these cases. Nonparallel calculations are unchanged.

Validation

  • 13 parallel/coincident cases cover axis-aligned and oblique directions, positive/negative and unequal Plucker scales, operand reversal and singleton/sequence broadcasting. All fail before and pass after.
  • Six intersecting/skew controls pass before and after. Parallel distances are checked against independent Euclidean projection.
  • Full local suite: 585 passed, 3 skipped, 99 subtests passed; 29 existing warnings. Fresh baseline: 566 passed with the same skips/subtests/warnings.
  • Black 23.10.0, fatal-error flake8 and git diff --check pass.

This handles the parallel closest-point case, distinct from #224's distance calculation, #232's relation predicates and #273's unique intersection point. AI assistance was used for investigation, implementation and tests. Validated locally without robot hardware.

Updated handling of parallel lines in closest point calculation.
Add tests for closest-point queries on parallel lines and ensure finite results.

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.

1 participant