pub struct UnitCircle;Expand description
A uniform distribution of unit 2-vectors.
Trait Implementations§
Source§impl Clone for UnitCircle
impl Clone for UnitCircle
Source§fn clone(&self) -> UnitCircle
fn clone(&self) -> UnitCircle
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 UnitCircle
impl Debug for UnitCircle
Source§impl Distrib for UnitCircle
Available on crate feature fp only.
impl Distrib for UnitCircle
Available on crate feature
fp only.Source§fn sample(&self, rng: &mut DefaultRng) -> Vec2
fn sample(&self, rng: &mut DefaultRng) -> Vec2
Returns a unit 2-vector uniformly sampled from the unit circle.
§Example
use retrofire_core::math::{ApproxEq, rand::*};
let rng = &mut DefaultRng::default();
let vec = UnitCircle.sample(rng);
assert!(vec.len_sqr().approx_eq(&1.0));impl Copy for UnitCircle
Auto Trait Implementations§
impl Freeze for UnitCircle
impl RefUnwindSafe for UnitCircle
impl Send for UnitCircle
impl Sync for UnitCircle
impl Unpin for UnitCircle
impl UnwindSafe for UnitCircle
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