pub struct SamplerPoint<R: Rng> { /* private fields */ }Expand description
Wrapper around two Samplers 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 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<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,
A tuple of type (Sampler::<T>,Sampler<T>) will be interpreted as a uniform distribution if turned into a sampler.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more