Conversation
DJMcNab
left a comment
There was a problem hiding this comment.
Thanks, looks useful.
One concern I have is e.g. if you pass (1, 0, 1), (0, 1, 0), then the given box would potentially be weird. I don't know if there are any troubles with this case (which can also be reached manually or when using Box::new with negative numbers).
I wonder if it would make more sense to either rename it, or to automatically work out the minimum for each axis. It might be worth renaming new to from_side_lengths?
To be honest, I think Box could easily just be defined as min: Vec3, max: Vec3. I'm not sure why it wasn't defined as such in #883.
|
Yeah, I can code to work out the minimum, or asserts perhaps. It perhaps violates principal of least surprise to swap out if the minimums. Perhaps returning an Option is the best option. However, this kind of stuff is already in the shape primitives PR, and perhaps effort is best concentrated there..? Cheers |
alice-i-cecile
left a comment
There was a problem hiding this comment.
@rezural I like this, but I'd like to see:
- Basic doc strings.
- Assertions that min < max in all cases.
|
I'd rather just use |
|
Closing in favor of #6672. |
# Objective This add a ctor to `Box` to aid the creation of non-centred boxes. The PR adopts @rezural's work on PR #3322, taking into account the feedback on that PR from @james7132. ## Solution `Box::from_corners()` creates a `Box` from two opposing corners and automatically determines the min and max extents to ensure that the `Box` is well-formed. Co-authored-by: rezural <rezural@protonmail.com>
# Objective This add a ctor to `Box` to aid the creation of non-centred boxes. The PR adopts @rezural's work on PR bevyengine#3322, taking into account the feedback on that PR from @james7132. ## Solution `Box::from_corners()` creates a `Box` from two opposing corners and automatically determines the min and max extents to ensure that the `Box` is well-formed. Co-authored-by: rezural <rezural@protonmail.com>
# Objective This add a ctor to `Box` to aid the creation of non-centred boxes. The PR adopts @rezural's work on PR bevyengine#3322, taking into account the feedback on that PR from @james7132. ## Solution `Box::from_corners()` creates a `Box` from two opposing corners and automatically determines the min and max extents to ensure that the `Box` is well-formed. Co-authored-by: rezural <rezural@protonmail.com>
# Objective This add a ctor to `Box` to aid the creation of non-centred boxes. The PR adopts @rezural's work on PR bevyengine#3322, taking into account the feedback on that PR from @james7132. ## Solution `Box::from_corners()` creates a `Box` from two opposing corners and automatically determines the min and max extents to ensure that the `Box` is well-formed. Co-authored-by: rezural <rezural@protonmail.com>
Objective
Solution