From 9933995f6cd20e2169cbcf751f8647f9598c58f4 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 20 Nov 2014 16:06:53 +0300 Subject: [PATCH] Projection 2D failure due to incorrect detection of distorted result faces --- src/SMESH/SMESH_MesherHelper.cxx | 10 +++++----- src/StdMeshers/StdMeshers_Projection_2D.cxx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 329c17e62..c6c51ab37 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -2575,7 +2575,7 @@ bool SMESH_MesherHelper::IsDistorted2D( SMESH_subMesh* faceSM, if ( !smDS || smDS->NbElements() == 0 ) return false; SMDS_ElemIteratorPtr faceIt = smDS->GetElements(); - double prevArea2D = 0; + double prevArea = 0; vector< const SMDS_MeshNode* > nodes; vector< gp_XY > uv; bool* toCheckUV = checkUV ? & checkUV : 0; @@ -2613,15 +2613,15 @@ bool SMESH_MesherHelper::IsDistorted2D( SMESH_subMesh* faceSM, uv[ i ] = helper.GetNodeUV( F, nodes[ i ], inFaceNode, toCheckUV ); // compare orientation of triangles + double faceArea = 0; for ( int iT = 0, nbT = nodes.size()-2; iT < nbT; ++iT ) { gp_XY v1 = uv[ iT+1 ] - uv[ 0 ]; gp_XY v2 = uv[ iT+2 ] - uv[ 0 ]; - double area2D = v2 ^ v1; - if (( haveBadFaces = ( area2D * prevArea2D < 0 ))) - break; - prevArea2D = area2D; + faceArea += v2 ^ v1; } + haveBadFaces = ( faceArea * prevArea < 0 ); + prevArea = faceArea; } return haveBadFaces; diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 057070d1c..7b3d1e1e1 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -732,7 +732,7 @@ namespace { (( uv - uvBis ).SquareModulus() < tol2d )) ++nbOkPos; else - nbOkPos = 0; + nbOkPos = -((int) src2tgtNodes.size() ); break; } case SMDS_TOP_EDGE: