summaryrefslogtreecommitdiff
path: root/vec.h
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-21 20:59:43 +0800
committerKeuin <[email protected]>2022-04-21 20:59:43 +0800
commit5f92f7182311b111a1bb9ac2f3bccb9eb5754c2c (patch)
treeb17c0ace4e825c391997545f8ea5654498264204 /vec.h
parent40b96a150f25db34f5b213374fae0e74d02f0cc6 (diff)
Bugfix: vec3::refract assertion fails in complex scenarios. Use looser accuracy requirement.
Diffstat (limited to 'vec.h')
-rw-r--r--vec.h4
1 files 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<bool Enable_TIR>
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