From: eap Date: Mon, 29 Sep 2014 11:50:55 +0000 (+0400) Subject: 22711: [CEA 1297] Regression of mesh with a projection on a spherical face X-Git-Tag: V7_5_0a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=079e65a9b152c9dec23fa91a346ac312b04eb145;p=modules%2Fsmesh.git 22711: [CEA 1297] Regression of mesh with a projection on a spherical face In fixDistortedFaces() care of face planarity and degenerated edges --- diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index b4f3e3b55..5e4586bed 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -935,13 +936,23 @@ namespace { for ( size_t i = 0; i < nodes.size(); ++n, ++i ) nodes[ i ] = *n; - // get UVs + // avoid elems on degenarate shapes as UV on them can be wrong + if ( helper.HasDegeneratedEdges() ) + { + bool isOnDegen = false; + for ( size_t i = 0; ( i < nodes.size() && !isOnDegen ); ++i ) + isOnDegen = helper.IsDegenShape( nodes[ i ]->getshapeId() ); + if ( isOnDegen ) + continue; + } + // prepare to getting UVs const SMDS_MeshNode* inFaceNode = 0; if ( helper.HasSeam() ) for ( size_t i = 0; ( i < nodes.size() && !inFaceNode ); ++i ) if ( !helper.IsSeamShape( nodes[ i ]->getshapeId() )) inFaceNode = nodes[ i ]; + // get UVs uv.resize( nodes.size() ); for ( size_t i = 0; i < nodes.size(); ++i ) uv[ i ] = helper.GetNodeUV( F, nodes[ i ], inFaceNode ); @@ -989,10 +1000,15 @@ namespace { SMESH_MeshEditor:: SmoothMethod algo = isConcaveBoundary ? SMESH_MeshEditor::CENTROIDAL : SMESH_MeshEditor::LAPLACIAN; + // smooth in 2D or 3D? + TopLoc_Location loc; + Handle(Geom_Surface) surface = BRep_Tool::Surface( F, loc ); + bool isPlanar = GeomLib_IsPlanarSurface( surface ).IsPlanar(); + // smoothing set fixedNodes; editor.Smooth( faces, fixedNodes, algo, /*nbIterations=*/ 10, - /*theTgtAspectRatio=*/1.0, /*the2D=*/false); + /*theTgtAspectRatio=*/1.0, /*the2D=*/!isPlanar); } }