14 bool interpolationCellPointFace<Type>::findTriangle
18 label tetPointLabels[],
22 bool foundTriangle =
false;
24 const labelList& facePoints = this->pMeshFaces_[nFace];
25 tetPoints[2] = this->pMeshFaceCentres_[nFace];
29 while (pointi < facePoints.size() && !foundTriangle)
33 label nextPointLabel = (pointi + 1) % facePoints.
size();
35 tetPointLabels[0] = facePoints[pointi];
36 tetPointLabels[1] = facePoints[nextPointLabel];
38 tetPoints[0] = this->pMeshPoints_[tetPointLabels[0]];
39 tetPoints[1] = this->pMeshPoints_[tetPointLabels[1]];
41 vector fc = (tetPoints[0] + tetPoints[1] + tetPoints[2])/3.0;
43 vector newPos = position + SMALL*(fc-position);
48 for (label i=0; i<3; i++)
50 label ip0 = (i+1) % 3;
51 label ipp = (i+2) % 3;
52 edge[i] = tetPoints[ipp]-tetPoints[ip0];
55 vector triangleFaceNormal = edge[1] ^ edge[2];
58 for (label i=0; i<3; i++)
60 normal[i] =
normalised(triangleFaceNormal ^ edge[i]);
65 for (label i=0; i<3; i++)
68 inside = inside && (((newPos - tetPoints[ip]) & edge[i]) >= 0);
76 for (label i=0; i<3; i++)
79 scalar phiMax =
max(VSMALL, normal[i] & edge[ip]);
80 scalar phiLength = (position-tetPoints[ip]) & normal[i];
81 phi[i] = phiLength/phiMax;
void size(const label n)
Older name for setAddressableSize.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
List< label > labelList
A List of labels.