handling tiny triangles

This commit is contained in:
mattijs 2008-08-27 18:09:53 +01:00
parent 6e02125e05
commit 4dc1c78a28

View File

@ -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))