46 label tetLabelCandidate[],
47 label tetPointLabels[],
49 scalar phiCandidate[],
54 bool foundTet =
false;
56 const labelList& thisFacePoints = this->pMeshFaces_[nFace];
57 tetPoints[2] = this->pMeshFaceCentres_[nFace];
61 while (pointi < thisFacePoints.
size() && !foundTet)
63 label nextPointLabel = (pointi + 1) % thisFacePoints.
size();
65 tetPointLabels[0] = thisFacePoints[pointi];
66 tetPointLabels[1] = thisFacePoints[nextPointLabel];
68 tetPoints[0] = this->pMeshPoints_[tetPointLabels[0]];
69 tetPoints[1] = this->pMeshPoints_[tetPointLabels[1]];
80 vector referencePoint, faceNormal;
87 faceNormal /=
mag(faceNormal);
91 scalar
correct = v0 & faceNormal;
94 faceNormal = -faceNormal;
97 vector v1 = position - referencePoint + SMALL*faceNormal;
98 scalar rightSide = v1 & faceNormal;
102 inside = inside && (rightSide >= 0);
104 scalar phiLength = (position - referencePoint) & faceNormal;
109 phi[
n] = phiLength/maxLength;
116 if (
mag(dist - 1.0) < minDistance)
118 minDistance =
mag(dist - 1.0);
121 for (
label i=0; i<4; i++)
123 phiCandidate[i] =
phi[i];
126 tetLabelCandidate[0] = tetPointLabels[0];
127 tetLabelCandidate[1] = tetPointLabels[1];