pub struct UnitSphere;Expand description
A uniform distribution of unit 3-vectors.
Trait Implementations§
Source§impl Clone for UnitSphere
impl Clone for UnitSphere
Source§fn clone(&self) -> UnitSphere
fn clone(&self) -> UnitSphere
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnitSphere
impl Debug for UnitSphere
Source§impl Default for UnitSphere
impl Default for UnitSphere
Source§fn default() -> UnitSphere
fn default() -> UnitSphere
Returns the “default value” for a type. Read more
Source§impl Distrib for UnitSphere
Available on crate feature fp only.
impl Distrib for UnitSphere
Available on crate feature
fp only.Source§fn sample(&self, rng: &mut DefaultRng) -> Vec3
fn sample(&self, rng: &mut DefaultRng) -> Vec3
Returns a unit 3-vector uniformly sampled from the unit sphere.
§Example
use retrofire_core::assert_approx_eq;
use retrofire_core::math::rand::*;
let rng = &mut DefaultRng::default();
let vec = UnitSphere.sample(rng);
assert_approx_eq!(vec.len_sqr(), 1.0);impl Copy for UnitSphere
Auto Trait Implementations§
impl Freeze for UnitSphere
impl RefUnwindSafe for UnitSphere
impl Send for UnitSphere
impl Sync for UnitSphere
impl Unpin for UnitSphere
impl UnwindSafe for UnitSphere
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