From fdbd4a13856e7c76280f4c8d7d155475b48db470 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Wed, 10 Feb 2021 23:51:35 +0100
Subject: [PATCH] [App/U] Vector operations for min/max and compare.

---
 Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp b/Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
index 38b143ff6cc..434cd4c95c0 100644
--- a/Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
+++ b/Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
@@ -54,17 +54,8 @@ bool testTriangleIntersectingAABB(MeshLib::Node const& n0,
         Eigen::Vector3d(n2.getCoords()) - c;
 
     // Test the three axes corresponding to the face normals of AABB b
-    Eigen::Vector3d const min_coeff = v.rowwise().minCoeff();
-    Eigen::Vector3d const max_coeff = v.rowwise().maxCoeff();
-    if (max_coeff.x() < -e.x() || min_coeff.x() > e.x())
-    {
-        return false;
-    }
-    if (max_coeff.y() < -e.y() || min_coeff.y() > e.y())
-    {
-        return false;
-    }
-    if (max_coeff.z() < -e.z() || min_coeff.z() > e.z())
+    if (((v.rowwise().minCoeff() - e).array() > 0).any() ||
+        ((v.rowwise().maxCoeff() + e).array() < 0).any())
     {
         return false;
     }
-- 
GitLab