Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions rstar/src/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ where
}
}

/// Creates a new AABB from a center and a diameter.
pub fn from_center(center: P, diameter: P::Scalar) -> Self {
let one = P::Scalar::one();
let two = one + one;
let radius = P::from_value(diameter / two);
/// Creates a new AABB from a center and a distance.
pub fn from_center(center: P, distance: P::Scalar) -> Self {
let distance = P::from_value(distance);

let p1 = center.add(&radius);
let p2 = center.sub(&radius);
let p1 = center.add(&distance);
let p2 = center.sub(&distance);

Self::from_corners(p1, p2)
}
Expand Down