From 98ad301e091b49474dfc4971726bc5d2d567ab68 Mon Sep 17 00:00:00 2001
From: Yoel <s73017@beuth-hochschule.de>
Date: Mon, 23 Nov 2020 14:50:24 +0100
Subject: [PATCH] Fixed small error in sampling

---
 RayTracer/shape/RectanglePlane.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/RayTracer/shape/RectanglePlane.cpp b/RayTracer/shape/RectanglePlane.cpp
index fe8fb65..04e5ba2 100644
--- a/RayTracer/shape/RectanglePlane.cpp
+++ b/RayTracer/shape/RectanglePlane.cpp
@@ -43,7 +43,7 @@ util::SurfacePoint RectanglePlane::sampleLight() const {
 	// X coord of the sampled point.
 	float x = util::disMinus1To1(util::gen) * width / 2;
 	// Z coord of the sampled point.
-	float z = util::disMinus1To1(util::gen) * width / 2;
+	float z = util::disMinus1To1(util::gen) * depth / 2;
 	return util::SurfacePoint(util::Vec3(x, 0, z), util::Vec3(0, 1, 0),
 	                          material);
 	// The sampled point will be in local coordinates.
-- 
GitLab