diff options
Diffstat (limited to 'src/sample')
-rw-r--r-- | src/sample/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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(), + ) + } } |