Add Annulus primitive to bevy_math::primitives#12706
Add Annulus primitive to bevy_math::primitives#12706alice-i-cecile merged 7 commits intobevyengine:mainfrom Chubercik:annulus-primitive
Annulus primitive to bevy_math::primitives#12706Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
Some feedback on documentation :) Useful shape though!
Jondolf
left a comment
There was a problem hiding this comment.
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 |
Jondolf
left a comment
There was a problem hiding this comment.
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:  --- ## 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:  --- ## 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
Annulusprimitive to thebevy_mathcrateAnnulustests (diameter,thickness,area,perimeterandclosest_pointmethods)