From 337aca5fd5028bd7c189bd292c209fc9cba06041 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 14 Jun 2018 14:31:07 +0200 Subject: [PATCH] ENH: reduce some isoSurfaceCell regularise failures (closes #870) - when the iso-surface (eg, a cut plane, or distanceSurface) passes exactly through the cell centre, zero-sized triangles can occur. These should be merged away. --- .../surface/isoSurface/isoSurfaceCell.C | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/sampling/surface/isoSurface/isoSurfaceCell.C b/src/sampling/surface/isoSurface/isoSurfaceCell.C index 05d2eb00f2c..47b539f2509 100644 --- a/src/sampling/surface/isoSurface/isoSurfaceCell.C +++ b/src/sampling/surface/isoSurface/isoSurfaceCell.C @@ -284,16 +284,18 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface if (shared[0] != -1) { - vector n0 = tri0.normal(localPoints); - n0 /= mag(n0); - vector n1 = tri1.normal(localPoints); - n1 /= mag(n1); + const vector n0 = tri0.normal(localPoints); + const vector n1 = tri1.normal(localPoints); - if ((n0 & n1) < 0) - { - // Too big an angle. Do not simplify. - } - else + // Merge any zero-sized triangles, + // or if they point in the same direction. + + if + ( + mag(n0) <= ROOTVSMALL + || mag(n1) <= ROOTVSMALL + || (n0 & n1) >= 0 + ) { info.setPoint ( -- GitLab