Skip to main content

BoundingSphereRadius

Trait BoundingSphereRadius 

Source
pub trait BoundingSphereRadius {
    // Required method
    fn bounding_sphere_radius(&self) -> PositiveReal;
}
Expand description

Radius of an N-dimensional hypersphere that bounds a shape.

The hypersphere has the same local origin as the shape self.

Some IntersectsAt tests use the bounding sphere radius as a first pass before calling a more expensive intersection test. To improve performance, the bounding sphere should be as tightly fitting as possible.

§Example

use hoomd_geometry::{BoundingSphereRadius, shape::Hypercuboid};

let cuboid = Hypercuboid {
    edge_lengths: [6.0.try_into()?, 8.0.try_into()?],
};
let bounding_radius = cuboid.bounding_sphere_radius();

assert_eq!(bounding_radius.get(), 5.0);

Required Methods§

Source

fn bounding_sphere_radius(&self) -> PositiveReal

Get the bounding radius.

Implementors§