pub struct Ball {
pub radius: PositiveReal,
}Expand description
A uniform distribution of all points inside or on a sphere with radius r.
§Example
use hoomd_vector::{Cartesian, distribution::Ball};
use rand::{Rng, SeedableRng, distr::Distribution, rngs::StdRng};
let mut rng = StdRng::seed_from_u64(1);
let r = 5.0;
let ball = Ball {
radius: r.try_into()?,
};
let v: Cartesian<3> = ball.sample(&mut rng);Fields§
§radius: PositiveRealThe radius of the ball ([length]).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Ball
impl<'de> Deserialize<'de> for Ball
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize> Distribution<Cartesian<N>> for Ball
impl<const N: usize> Distribution<Cartesian<N>> for Ball
impl StructuralPartialEq for Ball
Auto Trait Implementations§
impl Freeze for Ball
impl RefUnwindSafe for Ball
impl Send for Ball
impl Sync for Ball
impl Unpin for Ball
impl UnsafeUnpin for Ball
impl UnwindSafe for Ball
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more