From ec4d55bb5d38fd0756a1166777335a622ae101bd Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 9 Oct 2017 15:34:10 +0100 Subject: [PATCH] ENH: surfaceFeatures: survive zero length edge. Fixes #616. --- .../triSurface/surfaceFeatures/surfaceFeatures.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 8da032518b..7877bdfc2d 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -243,12 +243,16 @@ void Foam::surfaceFeatures::calcFeatPoints if (edgeStat[edgeI] != NONE) { - edgeVecs.append(edges[edgeI].vec(localPoints)); - edgeVecs.last() /= mag(edgeVecs.last()); + vector vec = edges[edgeI].vec(localPoints); + scalar magVec = mag(vec); + if (magVec > SMALL) + { + edgeVecs.append(vec/magVec); + } } } - if (mag(edgeVecs[0] & edgeVecs[1]) < minCos) + if (edgeVecs.size() == 2 && mag(edgeVecs[0] & edgeVecs[1]) < minCos) { featurePoints.append(pointi); } -- GitLab