From b1e653765975696f95f4e397ede465621f31993b Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Tue, 15 Nov 2011 09:47:07 +0000
Subject: [PATCH] ENH: Updates to faceAreaIntersect

---
 .../faceAreaIntersect/faceAreaIntersect.C     | 38 ++++++++++---------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
index cc1146c4ed3..3d3a72e3a45 100644
--- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
+++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
@@ -78,7 +78,8 @@ void Foam::faceAreaIntersect::triSliceWithPlane
     (
         (nPos == 3)
      || ((nPos == 2) && (nCoPlanar == 1))
-     || ((nPos == 1) && (nCoPlanar == 2)))
+     || ((nPos == 1) && (nCoPlanar == 2))
+    )
     {
         /*
                 /\          _____
@@ -95,11 +96,12 @@ void Foam::faceAreaIntersect::triSliceWithPlane
     else if ((nPos == 2) && (nCoPlanar == 0))
     {
         /*
-             ________
-             \      /
-            --\----/--
-               \  /
-                \/
+            i1________i2
+              \      /
+             --\----/--
+                \  /
+                 \/
+                 i0
 
             2 points above plane, 1 below
             - resulting quad above plane split into 2 triangles
@@ -130,10 +132,12 @@ void Foam::faceAreaIntersect::triSliceWithPlane
         if (nCoPlanar == 0)
         {
             /*
-                   /\
-                  /  \
-               --/----\--
-                /______\
+                     i0
+                     /\
+                    /  \
+                 --/----\--
+                  /______\
+                i2        i1
 
                 1 point above plane, 2 below
                 - keep triangle above intersection plane
@@ -145,8 +149,8 @@ void Foam::faceAreaIntersect::triSliceWithPlane
             label i2 = d.fcIndex(i1);
 
             // determine the two intersection points
-            point p01 = planeIntersection(d, tri, i0, i1);
-            point p02 = planeIntersection(d, tri, i0, i2);
+            point p01 = planeIntersection(d, tri, i1, i0);
+            point p02 = planeIntersection(d, tri, i2, i0);
 
             // add triangle above plane to list
             setTriPoints(tri[i0], p01, p02, nTris, tris);
@@ -154,14 +158,14 @@ void Foam::faceAreaIntersect::triSliceWithPlane
         else
         {
             /*
-
+                  i0
                   |\
                   | \
-                __|__\__
+                __|__\_i2_
                   |  /
                   | /
                   |/
-
+                  i1
 
                 1 point above plane, 1 on plane, 1 below
                 - keep triangle above intersection plane
@@ -172,9 +176,9 @@ void Foam::faceAreaIntersect::triSliceWithPlane
             label i2 = copI;
 
             // determine the intersection point
-            point p01 = planeIntersection(d, tri, i0, i1);
+            point p01 = planeIntersection(d, tri, i1, i0);
 
-            // add triangle above plane to list
+            // add triangle above plane to list - clockwise points
             if (d.fcIndex(i0) == i1)
             {
                 setTriPoints(tri[i0], p01, tri[i2], nTris, tris);
-- 
GitLab