]> git.localhorst.tv Git - blank.git/commitdiff
fix box/box normal
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 20 Nov 2015 15:27:22 +0000 (16:27 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 20 Nov 2015 15:27:22 +0000 (16:27 +0100)
oops

it's a sin

src/geometry/geometry.cpp

index 090f78730474f38f0a1c8888cc0f724ad6988128..7d099cf156de9caa2650983395a7dfc562f03a8f 100644 (file)
@@ -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<float>::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;
                }