From 36689dfeb8e2e9dcd29c7820dabd5ccaa971a337 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 15 Apr 2022 14:49:53 +0800 Subject: Bugfix: wrong assertion. --- material_diffusive.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/material_diffusive.cpp b/material_diffusive.cpp index 74f58f7..b3f0207 100644 --- a/material_diffusive.cpp +++ b/material_diffusive.cpp @@ -20,8 +20,12 @@ bool material_diffuse_lambertian::scatter(ray3d &r, const object &hit_obj, doubl } material_diffuse_lambertian::material_diffuse_lambertian(vec3d albedo) : albedo(albedo) { - assert(albedo.mod2() >= 0); - assert(albedo.mod2() <= 1); + assert(albedo.x >= 0); + assert(albedo.y >= 0); + assert(albedo.z >= 0); + assert(albedo.x <= 1); + assert(albedo.y <= 1); + assert(albedo.z <= 1); } material_diffuse_lambertian::material_diffuse_lambertian(double albedo) : albedo{albedo, albedo, albedo} { @@ -30,8 +34,12 @@ material_diffuse_lambertian::material_diffuse_lambertian(double albedo) : albedo } material_diffuse_simple::material_diffuse_simple(vec3d albedo) : albedo(albedo) { - assert(albedo.mod2() >= 0); - assert(albedo.mod2() <= 1); + assert(albedo.x >= 0); + assert(albedo.y >= 0); + assert(albedo.z >= 0); + assert(albedo.x <= 1); + assert(albedo.y <= 1); + assert(albedo.z <= 1); } bool material_diffuse_simple::scatter(ray3d &r, const object &hit_obj, double hit_t, random_uv_gen_3d &ruvg) const { @@ -53,8 +61,12 @@ material_diffuse_simple::material_diffuse_simple(double albedo) : albedo{albedo, } material_diffuse_hemispherical::material_diffuse_hemispherical(vec3d albedo) : albedo(albedo) { - assert(albedo.mod2() >= 0); - assert(albedo.mod2() <= 1); + assert(albedo.x >= 0); + assert(albedo.y >= 0); + assert(albedo.z >= 0); + assert(albedo.x <= 1); + assert(albedo.y <= 1); + assert(albedo.z <= 1); } bool -- cgit v1.2.3