From: Daniel Karbach Date: Fri, 20 Nov 2015 15:27:22 +0000 (+0100) Subject: fix box/box normal X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=0ac44f8cd740889f13b07e42327eaacff72830d0;p=blank.git fix box/box normal oops it's a sin --- diff --git a/src/geometry/geometry.cpp b/src/geometry/geometry.cpp index 090f787..7d099cf 100644 --- a/src/geometry/geometry.cpp +++ b/src/geometry/geometry.cpp @@ -134,15 +134,15 @@ bool Intersection( glm::vec3(b_m[0]), glm::vec3(b_m[1]), glm::vec3(b_m[2]), - cross(glm::vec3(a_m[0]), glm::vec3(b_m[0])), - cross(glm::vec3(a_m[0]), glm::vec3(b_m[1])), - cross(glm::vec3(a_m[0]), glm::vec3(b_m[2])), - cross(glm::vec3(a_m[1]), glm::vec3(b_m[0])), - cross(glm::vec3(a_m[1]), glm::vec3(b_m[1])), - cross(glm::vec3(a_m[1]), glm::vec3(b_m[2])), - cross(glm::vec3(a_m[2]), glm::vec3(b_m[0])), - cross(glm::vec3(a_m[2]), glm::vec3(b_m[1])), - cross(glm::vec3(a_m[2]), glm::vec3(b_m[2])), + normalize(cross(glm::vec3(a_m[0]), glm::vec3(b_m[0]))), + normalize(cross(glm::vec3(a_m[0]), glm::vec3(b_m[1]))), + normalize(cross(glm::vec3(a_m[0]), glm::vec3(b_m[2]))), + normalize(cross(glm::vec3(a_m[1]), glm::vec3(b_m[0]))), + normalize(cross(glm::vec3(a_m[1]), glm::vec3(b_m[1]))), + normalize(cross(glm::vec3(a_m[1]), glm::vec3(b_m[2]))), + normalize(cross(glm::vec3(a_m[2]), glm::vec3(b_m[0]))), + normalize(cross(glm::vec3(a_m[2]), glm::vec3(b_m[1]))), + normalize(cross(glm::vec3(a_m[2]), glm::vec3(b_m[2]))), }; depth = std::numeric_limits::infinity(); @@ -150,7 +150,7 @@ bool Intersection( int cur_axis = 0; for (const glm::vec3 &axis : axes) { - if (iszero(axis)) { + if (any(isnan(axis))) { // can result from the cross products if A and B have parallel axes continue; }