Skip to content

Fix ray obb degenerate axes - #1454

Open
byjtew wants to merge 2 commits into
CesiumGS:mainfrom
byjtew:fix-ray-obb-degenerate-axes
Open

byjtew wants to merge 2 commits into
CesiumGS:mainfrom
byjtew:fix-ray-obb-degenerate-axes

Conversation

@byjtew

@byjtew byjtew commented Sep 25, 2026

Copy link
Copy Markdown

Description

IntersectionTests::rayOBBParametric divides each half axis by its length to recover the box rotation. A zero-length axis (flat box) produces NaN and skewed half axes produce a non-orthonormal matrix, so the ray is silently rejected or the caller crashes. Height sampling hits this on tilesets with such boxes.

Now a single zero-length axis is rebuilt from the cross product of the other two, two or more return no hit, and the transformed ray direction is normalized so skewed boxes are still tested (with the hit distance scaled back to the original ray).

Issue number or link

I can create one if you want.

Author checklist

  • I have submitted a Contributor License Agreement (only needed once).
  • I have done a full self-review of my code.
  • I have updated CHANGES.md with a short summary of my change (for user-facing changes).
  • I have added or updated unit tests to ensure consistent code coverage as necessary.
  • I have updated the documentation as necessary. <-- internal fix, up to you guys to decide if that requires doc update

Testing plan

New IntersectionTests::rayOBB with malformed half axes test case: flat box hit on its face, flat box missed beside its face, box with no extent never hit, skewed box hit through its center. The test commit fails on main and passes with the fix.

@byjtew

byjtew commented Sep 25, 2026

Copy link
Copy Markdown
Author

For context I discovered that one trying to sample altitude on a freshly updated to v1.1 local tileset.
Seems like the cesium-tools could use a fix as well to trim degenerate volumes.

@j9liu j9liu added this to the November 2026 Release milestone Sep 28, 2026
@j9liu
j9liu self-requested a review September 28, 2026 17:27
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