Add .contains_aabb for Frustum#16022
Merged
mockersf merged 13 commits intobevyengine:mainfrom Dec 1, 2024
Merged
Conversation
BenjaminBrienen
approved these changes
Oct 26, 2024
Contributor
Author
|
Hi @alice-i-cecile , this pull request is ready for review. Could you please remove the "Waiting on Author" label and assign some reviewers. Thank you. |
Contributor
|
I'll review later today, I have some comments to the math. |
IQuick143
suggested changes
Nov 8, 2024
Contributor
IQuick143
left a comment
There was a problem hiding this comment.
I'll have to go over the geometry to make sure the algorithm is correct, but I've left some comments regarding algebraic simplifications of the code. (Most notably they enable better SIMD optimisations by the compiler.)
Co-authored-by: IQuick 143 <[email protected]>
Co-authored-by: IQuick 143 <[email protected]>
Contributor
Author
|
Hi @IQuick143 , sorry for the late response. I have resolved all the issues and added some cases involving rotation, please take another look and review them. Thank you! |
IQuick143
reviewed
Nov 23, 2024
IQuick143
reviewed
Nov 23, 2024
Co-authored-by: IQuick 143 <[email protected]>
IQuick143
approved these changes
Nov 24, 2024
Contributor
IQuick143
left a comment
There was a problem hiding this comment.
Seems good, hope I didn't miss anything.
Thanks for the PR.
mockersf
approved these changes
Dec 1, 2024
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Dec 2, 2024
# Objective - Fixes: bevyengine#15663 ## Solution - Add an `is_forward_plane` method to `Aabb`, and a `contains_aabb` method to `Frustum`. ## Test - I have created a frustum with an offset along with three unit tests to evaluate the `contains_aabb` algorithm. ## Explanation for the Test Cases - To facilitate the code review, I will explain how the frustum is created. Initially, we create a frustum without any offset and then create a cuboid that is just contained within it. <img width="714" alt="image" src="https://github.com/user-attachments/assets/a9ac53a2-f8a3-4e09-b20b-4ee71b27a099"> - Secondly, we move the cuboid by 2 units along both the x-axis and the y-axis to make it more general. ## Reference - [Frustum Culling](https://learnopengl.com/Guest-Articles/2021/Scene/Frustum-Culling#) - [AABB Plane intersection](https://gdbooks.gitbooks.io/3dcollisions/content/Chapter2/static_aabb_plane.html) --------- Co-authored-by: IQuick 143 <[email protected]>
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Jan 6, 2025
# Objective - Fixes: bevyengine#15663 ## Solution - Add an `is_forward_plane` method to `Aabb`, and a `contains_aabb` method to `Frustum`. ## Test - I have created a frustum with an offset along with three unit tests to evaluate the `contains_aabb` algorithm. ## Explanation for the Test Cases - To facilitate the code review, I will explain how the frustum is created. Initially, we create a frustum without any offset and then create a cuboid that is just contained within it. <img width="714" alt="image" src="https://github.com/user-attachments/assets/a9ac53a2-f8a3-4e09-b20b-4ee71b27a099"> - Secondly, we move the cuboid by 2 units along both the x-axis and the y-axis to make it more general. ## Reference - [Frustum Culling](https://learnopengl.com/Guest-Articles/2021/Scene/Frustum-Culling#) - [AABB Plane intersection](https://gdbooks.gitbooks.io/3dcollisions/content/Chapter2/static_aabb_plane.html) --------- Co-authored-by: IQuick 143 <[email protected]>
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.
Objective
.contains_aabbforFrustum#15663Solution
is_forward_planemethod toAabb, and acontains_aabbmethod toFrustum.Test
contains_aabbalgorithm.Explanation for the Test Cases
Reference