Skip to content
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 Aabb2d::new and Aabb3d::new constructors #11433

Merged
merged 4 commits into from
Jan 20, 2024

Conversation

Jondolf
Copy link
Contributor

@Jondolf Jondolf commented Jan 20, 2024

Objective

Currently, the only way to create an AABB is to specify its min and max coordinates. However, it's often more useful to use the center and half-size instead.

Solution

Add new constructors for Aabb2d and Aabb3d.

This:

let aabb = Aabb3d {
    min: center - half_size,
    max: center + half_size,
}

becomes this:

let aabb = Aabb3d::new(center, half_size);

I also made the usage of "half-extents" vs. "half-size" a bit more consistent.

@Jondolf Jondolf added C-Usability A simple quality-of-life change that makes Bevy easier to use A-Math Fundamental domain-agnostic mathematical operations labels Jan 20, 2024
@alice-i-cecile alice-i-cecile added this to the 0.13 milestone Jan 20, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jan 20, 2024
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 20, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 20, 2024
Merged via the queue into bevyengine:main with commit c31f3aa Jan 20, 2024
22 checks passed
@Jondolf Jondolf deleted the aabb-new-constructor branch January 20, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants