feat: Add AxisAlignedBox conversion helpers#667
Merged
ahcorde merged 5 commits intogazebosim:gz-math8from Mar 12, 2025
Merged
Conversation
Adds helper functions to create AxisAlignedBox from shapes Origin shapes: Box, Sphere, Capsure, Cylinder Fixes gazebosim#666 Signed-off-by: anshium <anshchablani@gmail.com>
For the files AxisAlignedBoxHelpers.hh, AxisAlignedBoxHelpers.cc and AxisAlignedBoxHelpers.hh in detail/ Signed-off-by: anshium <anshchablani@gmail.com>
ahcorde
requested changes
Mar 10, 2025
Contributor
ahcorde
left a comment
There was a problem hiding this comment.
Thank you for your contribution, Do you mind to add the python bindings too ? If you don't have time to do it please open a issue indicating that Python binding are missing for this new feature. Otherwise you can include them in this PR or open a new one.
9 tasks
style: improve comment formatting Signed-off-by: anshium <anshchablani@gmail.com>
Signed-off-by: anshium <anshchablani@gmail.com>
Contributor
Author
|
Made the said changes. Working on the python bindings now :) |
also add tests Signed-off-by: anshium <anshchablani@gmail.com>
Contributor
Author
|
Added the python bindings, along with tests. |
Contributor
Author
|
@ahcorde Hey! Just checking if there's anything else that needs to be updated/changed on this PR. Let me know if anything needs adjusting. Thanks! |
ahcorde
approved these changes
Mar 12, 2025
Contributor
|
Thank you for your contribution @anshium, looking forward seeing more PRs |
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.
Adds helper functions to create AxisAlignedBox from shapes Origin shapes: Box, Sphere, Capsure, Cylinder
🎉 New feature
Closes #666
Summary
Implementation of static helper functions in
gz::math::AxisAlignedBoxHelpersto convert shape objects (Box, Sphere, Capsule, Cylinder) into AxisAlignedBox objects.I have tried to write the functions in more or less the same format as other files. Since, the functions are template functions, I have kept their implementation in
gz/math/detail/AxisAlignedBoxHelpers.hhand the declarations ingz/math/AxisAlignedBoxHelpers.hh.I have also written comments in the same style as other files.
Also, I have added a few tests to check their correctness.
Test it
Testing can be done by creating a new shape:
math::Box<double> box(2.0, 4.0, 6.0);Then, using the helper function:
math::AxisAlignedBox aabb = math::AxisAlignedBoxHelpers<double>::ConvertToAxisAlignedBox(box);Then, can call functions like:
aabb.Min()The output would be:
Vector3d(-1.0, -2.0, -3.0)Checklist
codecheckpassed (See contributing)Doubts
I am not sure if we need an example / tutorial for these helper functions. Kindly let me know if we do, I will add them.
Also, kindly let me know if the python bindings have to be updated and where do I update the documentation.