diff --git a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C index 56f8799aeca73aecbcd18379f02531eed244621f..e8c9a29552b98e6701e2a26659748f49e9b244ba 100644 --- a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C +++ b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C @@ -101,6 +101,7 @@ bool Foam::triangleFuncs::intersectAxesBundle // Since direction is coordinate axis there is no need to do projection, // we can directly check u,v components for inclusion in triangle. + scalar localScale = max(max(magSqr(V10), magSqr(V20)), 1.0); // Get other components label i1 = (i0 + 1) % 3; @@ -114,8 +115,11 @@ bool Foam::triangleFuncs::intersectAxesBundle scalar det = v2*u1 - u2*v1; - // Fix for V0:(-31.71428 0 -15.10714) V10:(-1.285715 8.99165e-16 -1.142858) V20:(0 0 -1.678573) i0:0 - if (Foam::mag(det)/max(max(mag(V10),mag(V20)),1) < SMALL) + // Fix for V0:(-31.71428 0 -15.10714) + // V10:(-1.285715 8.99165e-16 -1.142858) + // V20:(0 0 -1.678573) + // i0:0 + if (Foam::mag(det)/localScale < SMALL) { // Triangle parallel to dir return false; @@ -132,7 +136,7 @@ bool Foam::triangleFuncs::intersectAxesBundle scalar beta = 0; bool inter = false; - if (Foam::mag(u1) < SMALL) + if (Foam::mag(u1)/localScale < SMALL) { beta = u0/u2; if ((beta >= 0) && (beta <= 1))