STYLE: use edge::unitVec() for improved code clarity

This commit is contained in:
Mark Olesen
2018-08-10 14:41:32 +02:00
parent c066dbf989
commit b81a2f2fa6
9 changed files with 18 additions and 36 deletions

View File

@ -429,13 +429,11 @@ bool Foam::cellFeatures::isFeaturePoint(const label edge0, const label edge1)
const edge& e0 = mesh_.edges()[edge0];
vector e0Vec = e0.vec(mesh_.points());
e0Vec /= mag(e0Vec);
const vector e0Vec = e0.unitVec(mesh_.points());
const edge& e1 = mesh_.edges()[edge1];
vector e1Vec = e1.vec(mesh_.points());
e1Vec /= mag(e1Vec);
const vector e1Vec = e1.unitVec(mesh_.points());
scalar cosAngle;

View File

@ -192,11 +192,7 @@ Foam::vector Foam::meshTools::normEdgeVec
const label edgeI
)
{
vector eVec = mesh.edges()[edgeI].vec(mesh.points());
eVec /= mag(eVec);
return eVec;
return mesh.edges()[edgeI].unitVec(mesh.points());
}

View File

@ -432,8 +432,8 @@ void Foam::searchableExtrudedCircle::getNormal
normal[i] = info[i].hitPoint()-curvePt.hitPoint();
// Subtract axial direction
vector axialVec = edges[curvePt.index()].vec(points);
axialVec /= mag(axialVec);
const vector axialVec = edges[curvePt.index()].unitVec(points);
normal[i] -= (normal[i]&axialVec)*axialVec;
normal[i] /= mag(normal[i]);
}