From 2008ccd1dd23a5f052a1f6cbda7bcee28466032b Mon Sep 17 00:00:00 2001 From: ws_plaxis <ws@plaxis.com> Date: Tue, 27 Mar 2018 09:04:38 +0200 Subject: [PATCH] Let also be the first point depending on which points overlap each other as different direction will result in wrong direction when trying to define the third point. This should solve failing test. --- Mesh/meshGFaceDelaunayInsertion.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index c643a0b127..b15446933a 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1315,20 +1315,24 @@ bool optimalPointFrontalB(GFace *gf, SVector3 n1, n2, v1v2, middle; if (v1->distance(v2) < tolerance || v2->distance(v3) < tolerance || v1->distance(v3) < tolerance) { - MVertex *vUniqueOtherPoint; - if (v1->distance(v3) < tolerance) + MVertex *vUniqueFirstPoint, *vUniqueSecondPoint; + if (v1->distance(v2) < tolerance) { - // v1 overlaps v3 - vUniqueOtherPoint = v2; + // v1 overlaps v2: take v2 -> v3 + vUniqueFirstPoint = v2; + vUniqueSecondPoint = v3; } else { - // v1 overlaps v2 or v3 overlaps v2: only consider v1 and v3 - vUniqueOtherPoint = v3; + // v3 overlaps v1 or v3 overlaps v2: take v1 -> v2 + vUniqueFirstPoint = v1; + vUniqueSecondPoint = v2; } - v1v2 = SVector3(vUniqueOtherPoint->x() - v1->x(), vUniqueOtherPoint->y() - v1->y(), vUniqueOtherPoint->z() - vUniqueOtherPoint->z()); - middle = SVector3((v1->x() + vUniqueOtherPoint->x())*.5, (v1->y() + vUniqueOtherPoint->y())*.5, (v1->z() + vUniqueOtherPoint->z())*.5); + v1v2 = SVector3(vUniqueSecondPoint->x() - vUniqueFirstPoint->x(), vUniqueSecondPoint->y() - vUniqueFirstPoint->y(), + vUniqueSecondPoint->z() - vUniqueFirstPoint->z()); + middle = SVector3((vUniqueFirstPoint->x() + vUniqueSecondPoint->x())*.5, + (vUniqueFirstPoint->y() + vUniqueSecondPoint->y())*.5, (vUniqueFirstPoint->z() + vUniqueSecondPoint->z())*.5); double uv[2] = {0, 0}; GPoint projectedPoint = gf->closestPoint(middle.point(), uv); n1 = gf->normal(SPoint2(projectedPoint.u(), projectedPoint.v())); -- GitLab