Skip to content

Add AABB::from_center utility constructor#222

Merged
adamreichold merged 1 commit intomasterfrom
from-center
Feb 26, 2026
Merged

Add AABB::from_center utility constructor#222
adamreichold merged 1 commit intomasterfrom
from-center

Conversation

@adamreichold
Copy link
Member

  • I agree to follow the project's code of conduct.
  • I added an entry to rstar/CHANGELOG.md if knowledge of this change could be valuable to users.

Closes #46

@adamreichold adamreichold added this pull request to the merge queue Feb 26, 2026
Merged via the queue into master with commit f0fe691 Feb 26, 2026
6 checks passed
@adamreichold adamreichold deleted the from-center branch February 26, 2026 10:03
}

/// Creates a new AABB from a center and a diameter.
pub fn from_center(center: P, diameter: P::Scalar) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would "width" be better? I feel like "diameter"/"radius" cannotes a circle.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did wonder about this back and forth because of the connotation. I stuck with diameter as it makes it explicit that extent is measured end-to-end instead of from the centre. (And it is an L∞ circle after all... ;))

Since this is unreleased, we can still change it. I wonder if we should expose an distance: P::Scalar parameter and actually remove the / (one + one) computation from the method? The caller presumably knows best whether to half the value and what its interpretation is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use PointExt methods in custom implementation

3 participants