From 94217187eb2785939458f08d96c7b1b9e55439ab Mon Sep 17 00:00:00 2001 From: Julian T Date: Sun, 17 Jan 2021 00:09:15 +0100 Subject: Minor changed and draft for random sampling --- src/render.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/render.cpp') diff --git a/src/render.cpp b/src/render.cpp index 286cbae..5762af4 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -34,9 +34,7 @@ Vec3d Sampler::sample(const Vec3d &norm) { auto theta = 2.0 * M_PI * m_src(); auto phi = acos(2.0 * m_src() - 1.0); - auto sinphi = sin(phi); - - auto newvec = Vec3d(cos(theta) * sinphi, sin(theta) * sinphi, cos(phi)); + auto newvec = Vec3d::FromSpherical(sin(theta), cos(theta), phi); if (newvec.dot(norm) <= 0) { newvec = -newvec; -- cgit v1.2.3