From 29f40776ed32adfabd46778f42c7befae582684c Mon Sep 17 00:00:00 2001
From: graham <g.macpherson@opencfd.co.uk>
Date: Fri, 9 Oct 2009 10:39:06 +0100
Subject: [PATCH] Fixing bug in faceIntersection where the sign of the distance
 was being discarded on return from the triPointRef intersecion test.  Was
 only appearing when using FULL_RAY tests.

---
 src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C
index c5f9a80250b..cf7dfc94005 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C
+++ b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C
@@ -159,9 +159,9 @@ Foam::pointHit Foam::face::intersection
 
         if (curHit.hit())
         {
-            if (Foam::mag(curHit.distance()) < nearestHitDist)
+            if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist))
             {
-                nearestHitDist = Foam::mag(curHit.distance());
+                nearestHitDist = curHit.distance();
                 nearest.setHit();
                 nearest.setPoint(curHit.hitPoint());
             }
-- 
GitLab