BUG: triSurfaceMesh: always assign normal

This commit is contained in:
mattijs
2012-06-18 14:29:55 +01:00
parent bb5a8daa09
commit 678783a870

View File

@ -827,6 +827,8 @@ void Foam::triSurfaceMesh::getNormal
vectorField& normal vectorField& normal
) const ) const
{ {
const triSurface& s = static_cast<const triSurface&>(*this);
normal.setSize(info.size()); normal.setSize(info.size());
if (minQuality_ >= 0) if (minQuality_ >= 0)
@ -834,7 +836,6 @@ void Foam::triSurfaceMesh::getNormal
// Make sure we don't use triangles with low quality since // Make sure we don't use triangles with low quality since
// normal is not reliable. // normal is not reliable.
const triSurface& s = static_cast<const triSurface&>(*this);
const labelListList& faceFaces = s.faceFaces(); const labelListList& faceFaces = s.faceFaces();
forAll(info, i) forAll(info, i)
@ -842,6 +843,7 @@ void Foam::triSurfaceMesh::getNormal
if (info[i].hit()) if (info[i].hit())
{ {
label faceI = info[i].index(); label faceI = info[i].index();
normal[i] = s[faceI].normal(points());
scalar qual = s[faceI].tri(points()).quality(); scalar qual = s[faceI].tri(points()).quality();
@ -861,11 +863,8 @@ void Foam::triSurfaceMesh::getNormal
} }
} }
} }
else
{ normal[i] /= mag(normal[i]) + VSMALL;
normal[i] = s[faceI].normal(points());
}
normal[i] /= mag(normal[i]);
} }
else else
{ {
@ -885,7 +884,7 @@ void Foam::triSurfaceMesh::getNormal
//normal[i] = faceNormals()[faceI]; //normal[i] = faceNormals()[faceI];
//- Uncached //- Uncached
normal[i] = triSurface::operator[](faceI).normal(points()); normal[i] = s[faceI].normal(points());
normal[i] /= mag(normal[i]) + VSMALL; normal[i] /= mag(normal[i]) + VSMALL;
} }
else else