-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Annulus
primitive to bevy_math::primitives
#12706
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some feedback on documentation :) Useful shape though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can implement Meshable
for this? Not sure what are the requirements.
The overall looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this! Left some suggestions though :)
I think we can leave meshing, gizmos, and bounding volumes for follow-ups. I don't see a reason to block on them, and adding everything at once can add friction to reviews, as we've seen with some other primitives.
Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Alright, every comment should've been accounted for :) As of right now, I don't really see the reason for using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm somewhat deliberating if we should call this Annulus
or Ring
; the latter would be more approachable and perhaps more obvious, but could have some ambiguities (2D or 3D?), while Annulus
is more mathematically accurate and unambiguously 2D.
I'm fine with either name, and Ring
is already a doc alias here so I think Annulus
should be fine.
As of right now, I don't really see the reason for using Circles (only the
diameter()
method got something out of it)
Yeah it didn't end up being very useful here specifically, but even just for users it could be nice to have methods for getting the diameter/area/perimeter of the inner and outer circle. We could add these methods to Annulus
directly, but I generally prefer reusing the existing primitives for things like this (where reasonable).
I went with (searching for "ring math" and "ring geometry" is an improvement, but there is still finger bling to be found here and there 😁) |
TBH, After I learned the math explanation, I found Annulus more fit. At the same time, I didn't understand it at first. Maybe we can have a link to a wikipedia explanation or something. |
# Objective - Depends on #12734. Since adding the `Annulus` primitive shape (#12706, #12734), the `2d_shapes` example has become outdated. ## Solution This PR adds the annulus shape to the `2d_shapes` example: ![image](https://github.com/bevyengine/bevy/assets/37378746/e620362d-bec6-4660-bf6e-d70babff8179) --- ## Changelog ### Added - `Annulus` shape to the `2d_shapes` example (~~as an added bonus, the example now features Newton's [ROYGBIV](https://en.wikipedia.org/wiki/ROYGBIV) rainbow palette ^^~~ no it doesn't, but one can shoehorn..)
# Objective - Depends on bevyengine#12734. Since adding the `Annulus` primitive shape (bevyengine#12706, bevyengine#12734), the `2d_shapes` example has become outdated. ## Solution This PR adds the annulus shape to the `2d_shapes` example: ![image](https://github.com/bevyengine/bevy/assets/37378746/e620362d-bec6-4660-bf6e-d70babff8179) --- ## Changelog ### Added - `Annulus` shape to the `2d_shapes` example (~~as an added bonus, the example now features Newton's [ROYGBIV](https://en.wikipedia.org/wiki/ROYGBIV) rainbow palette ^^~~ no it doesn't, but one can shoehorn..)
Objective
There is no 2D primitive available for the common shape of an annulus (ring).
Solution
This PR introduces a new type to the existing math primitives:
Annulus
: the region between two concentric circlesChangelog
Added
Annulus
primitive to thebevy_math
crateAnnulus
tests (diameter
,thickness
,area
,perimeter
andclosest_point
methods)