Struct rustic_zen::sampler::SamplerPoint
source · pub struct SamplerPoint<R: Rng> { /* private fields */ }
Expand description
Wrapper around two Sampler
s to make a Stochasically sampled point.
Trait Implementations§
source§impl<R: Clone + Rng> Clone for SamplerPoint<R>
impl<R: Clone + Rng> Clone for SamplerPoint<R>
source§fn clone(&self) -> SamplerPoint<R>
fn clone(&self) -> SamplerPoint<R>
Returns a copy 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<A, B, R> From<(A, B)> for SamplerPoint<R>
impl<A, B, R> From<(A, B)> for SamplerPoint<R>
source§impl<R> From<Point> for SamplerPoint<R>where
R: Rng,
impl<R> From<Point> for SamplerPoint<R>where
R: Rng,
A tuple of type (Sampler::<T>,Sampler<T>)
will be interpreted as a uniform distribution if turned into a sampler.
§Example:
extern crate rand;
use rustic_zen::sampler::SamplerPoint;
use rustic_zen::sampler::Sampler;
use rand::prelude::*;
let mut r = rand::thread_rng();
// results in a rounds soft distribution, useful for area lights.
let _p: SamplerPoint<ThreadRng> = (Sampler::new_gaussian(0.0, 3.0), Sampler::new_gaussian(0.0, 3.0)).into();
This is the only way to construct a SamplerPoint
. This shorthand can be extended using the Sampler
’s into traits:
extern crate rand;
use rustic_zen::sampler::SamplerPoint;
use rustic_zen::geom::Point;
use rand::prelude::*;
let mut r = rand::thread_rng();
// results in a fixed point at 0.0, 0.0
let _p: SamplerPoint<ThreadRng> = (0.0, 0.0).into();
// results in a uniformly distributed square from 0.0, 0.0 to 10.0, 10.0
let _p: SamplerPoint<ThreadRng> = ((0.0, 10.0), (0.0, 10.0)).into();
Auto Trait Implementations§
impl<R> Freeze for SamplerPoint<R>
impl<R> !RefUnwindSafe for SamplerPoint<R>
impl<R> Send for SamplerPoint<R>
impl<R> Sync for SamplerPoint<R>
impl<R> Unpin for SamplerPoint<R>
impl<R> !UnwindSafe for SamplerPoint<R>
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