From 5f92f7182311b111a1bb9ac2f3bccb9eb5754c2c Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 21 Apr 2022 20:59:43 +0800 Subject: Bugfix: vec3::refract assertion fails in complex scenarios. Use looser accuracy requirement. --- vec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vec.h b/vec.h index 11b9bd3..c109f7c 100644 --- a/vec.h +++ b/vec.h @@ -131,8 +131,8 @@ struct vec3 { // If TIR happens, the ray will be reflected. template vec3 refract(const vec3 &r1, double ri_inv) const { - assert(fabs(mod2() - 1.0) < 1e-12); - assert(fabs(r1.mod2() - 1.0) < 1e-12); + assert(fabs(mod2() - 1.0) < 1e-7); + assert(fabs(r1.mod2() - 1.0) < 1e-7); assert(ri_inv > 0); assert(dot(r1) < 0); // normal vector must be on the same side const auto &n = *this; // normal vector -- cgit v1.2.3