From 7ccc82fc0992fc23aee354d687ce009ae0523bea Mon Sep 17 00:00:00 2001 From: Julian T Date: Mon, 8 Feb 2021 18:26:27 +0100 Subject: Finish depth of field --- src/sample/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/sample/mod.rs') diff --git a/src/sample/mod.rs b/src/sample/mod.rs index 5095501..88e1aa9 100644 --- a/src/sample/mod.rs +++ b/src/sample/mod.rs @@ -29,4 +29,16 @@ pub trait Sampler { costheta, ) } + + fn get_in_circle(&mut self) -> Vector2f { + let s2d = self.get_sample_2d(); + + let d = s2d.x.sqrt(); + let theta = s2d.y * 2.0 * M_PI; + + Vector2f::new_xy( + d * theta.cos(), + d * theta.sin(), + ) + } } -- cgit v1.2.3