ENH: Improved code comments for triangle intersection area calc

This commit is contained in:
andy
2011-11-08 15:54:06 +00:00
parent 76cf75f935
commit 6400a2a484

View File

@ -53,9 +53,9 @@ void Foam::faceAreaIntersect::triSliceWithPlane
if (mag(d[i]) < matchTol*len) if (mag(d[i]) < matchTol*len)
{ {
d[i] = 0.0;
nCoPlanar++; nCoPlanar++;
copI = i; copI = i;
d[i] = 0.0;
} }
else else
{ {
@ -71,6 +71,9 @@ void Foam::faceAreaIntersect::triSliceWithPlane
} }
} }
// Determine triangle area contribution
if if
( (
(nPos == 3) (nPos == 3)
@ -78,6 +81,12 @@ void Foam::faceAreaIntersect::triSliceWithPlane
|| ((nPos == 1) && (nCoPlanar == 2))) || ((nPos == 1) && (nCoPlanar == 2)))
{ {
// all points above cutting plane - add triangle to list // all points above cutting plane - add triangle to list
// /\ _____
// / \ \ / /\
// /____\ \ / / \
// __________ ____v____ __/____\__
tris[nTris++] = tri; tris[nTris++] = tri;
} }
else if ((nPos == 2) && (nCoPlanar == 0)) else if ((nPos == 2) && (nCoPlanar == 0))
@ -85,6 +94,12 @@ void Foam::faceAreaIntersect::triSliceWithPlane
// 2 points above plane, 1 below // 2 points above plane, 1 below
// resulting quad above plane split into 2 triangles // resulting quad above plane split into 2 triangles
// ________
// \ /
// --\----/--
// \ /
// \/
// point under the plane // point under the plane
label i0 = negI; label i0 = negI;
@ -110,6 +125,11 @@ void Foam::faceAreaIntersect::triSliceWithPlane
{ {
// 1 point above plane, 2 below // 1 point above plane, 2 below
// /\
// / \
// --/----\--
// /______\
// indices of remaining points // indices of remaining points
label i1 = d.fcIndex(i0); label i1 = d.fcIndex(i0);
label i2 = d.fcIndex(i1); label i2 = d.fcIndex(i1);
@ -126,6 +146,13 @@ void Foam::faceAreaIntersect::triSliceWithPlane
{ {
// 1 point above plane, 1 on plane, 1 below // 1 point above plane, 1 on plane, 1 below
// |\
// | \
// __|__\__
// | /
// | /
// |/
// point indices // point indices
label i1 = negI; label i1 = negI;
label i2 = copI; label i2 = copI;
@ -147,6 +174,13 @@ void Foam::faceAreaIntersect::triSliceWithPlane
else else
{ {
// all points below cutting plane - forget // all points below cutting plane - forget
// _________ __________ ___________
// /\ \ /
// /\ / \ \ /
// / \ /____\ \/
// /____\
} }
} }