Repository navigation
Conversation
BoundingBox.intersectsRay(ray, point) required the entry distance to be non-negative, so a ray starting inside the box returned false, while the same call without a point returned true. OrientedBox.intersectsRay goes through the same code. Treat the box as hit unless it is entirely behind the ray, and report the exit point for a ray that starts inside.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BoundingBox.intersectsRay()gives different answers for the same ray depending on whether a hit point is requested. Without a point it uses_fastIntersectsRay()and reports a ray that starts inside the box as a hit. With a point it uses_intersectsRay(), which requires the entry distancemaxMin >= 0, so the same ray returnsfalse.OrientedBox.intersectsRay(ray, point)goes through_intersectsRay()and behaves the same way._intersectsRay()now treats the box as hit unless it is entirely behind the ray (minMax >= 0), so the result no longer depends on passingpoint.pointis set to where the ray leaves the box. A box entirely behind the ray still returnsfalse(the casemaxMin >= 0was added for in Fixed infinite raycast bug in aabb intersectsRay #828).BoundingBox.intersectsRay()andOrientedBox.intersectsRay()now describes the inside case.Public API change (behaviour only, no signature change):
Tests: added
#intersectsRaycases totest/core/shape/bounding-box.test.mjs(entry point from outside, exit point from inside, box behind the ray). The inside case fails before the change and passes after it, and thetest/core/shapetests pass (65). I also checkedOrientedBoxwith an identity transform: beforefalse, aftertruewith point (1, 0, 0).eslintis clean on the changed files. I did not run the fullnpm test.