Skip to content

Make plane containment independent of coefficient scale - #314

Open
kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-plane-contains-scale-nov19
Open

kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-plane-contains-scale-nov19

Conversation

@kaushikgunasekaren

Copy link
Copy Markdown

Bug

Plane3.contains compares the unnormalized plane-equation residual with tol * eps. Multiplying all plane coefficients by a nonzero constant describes the same plane but changes the result. For example, a point one micron away from x=2 is incorrectly accepted when its coefficients are scaled by 1e-12.

Change

Normalize the normal and constant coefficient together before applying the tolerance. The residual is then perpendicular distance from the plane, independent of coefficient scale. Use math.hypot for the normal length. Keep the existing behavior for zero-normal coefficients, rather than introducing a separate constructor-validation policy.

This is separate from the previously fixed constant-coefficient sign error. The existing tol parameter and its units in epsilon are retained; its distance meaning is documented.

Validation

  • 42 focused regression/control cases: 14 fail before the fix; all 42 pass after it.
  • Positive/negative scales from 1e-12 to 1e12; on-plane/off-plane points; explicit tolerance changes; oblique unit-distance controls; and existing degenerate-coefficient behavior.
  • Full local suite: 608 passed, 3 skipped, 99 subtests passed (21 warnings), versus 566 passed on unchanged master.
  • Changed-file Black 23.10.0 and fatal flake8 checks pass. Whole-repository fatal lint has two pre-existing undefined-name findings in tests/test_dualquaternion.py.

AI assistance was used for investigation, implementation and tests. Validation is local Python testing only; no hardware validation is claimed.

Compare perpendicular point-to-plane distance while preserving zero-normal behavior.
Cover signed coefficient scales, off-plane points, oblique normals and legacy degenerate behavior.

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