Allow "on edge" interior sampling

This commit is contained in:
Lynn Büttgenbach 2025-07-11 14:31:25 +02:00
parent d044295b75
commit 879c6af856

View File

@ -228,8 +228,8 @@ impl ShapeSample for Rhombus {
type Output = Vec2;
fn sample_interior<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec2 {
let x: f32 = rng.gen_range(0.0..1.0);
let y: f32 = rng.gen_range(0.0..1.0);
let x: f32 = rng.gen_range(0.0..=1.0);
let y: f32 = rng.gen_range(0.0..=1.0);
let unit_p = Vec2::NEG_X + x * Vec2::ONE + Vec2::new(y, -y);
unit_p * self.half_diagonals