mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-16 03:01:27 +05:00
22711: [CEA 1297] Regression of mesh with a projection on a spherical face
In fixDistortedFaces() care of face planarity and degenerated edges
This commit is contained in:
parent
f39630902e
commit
079e65a9b1
@ -51,6 +51,7 @@
|
|||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <Bnd_B2d.hxx>
|
#include <Bnd_B2d.hxx>
|
||||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||||
|
#include <GeomLib_IsPlanarSurface.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
|
||||||
@ -935,13 +936,23 @@ namespace {
|
|||||||
for ( size_t i = 0; i < nodes.size(); ++n, ++i )
|
for ( size_t i = 0; i < nodes.size(); ++n, ++i )
|
||||||
nodes[ i ] = *n;
|
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;
|
const SMDS_MeshNode* inFaceNode = 0;
|
||||||
if ( helper.HasSeam() )
|
if ( helper.HasSeam() )
|
||||||
for ( size_t i = 0; ( i < nodes.size() && !inFaceNode ); ++i )
|
for ( size_t i = 0; ( i < nodes.size() && !inFaceNode ); ++i )
|
||||||
if ( !helper.IsSeamShape( nodes[ i ]->getshapeId() ))
|
if ( !helper.IsSeamShape( nodes[ i ]->getshapeId() ))
|
||||||
inFaceNode = nodes[ i ];
|
inFaceNode = nodes[ i ];
|
||||||
|
|
||||||
|
// get UVs
|
||||||
uv.resize( nodes.size() );
|
uv.resize( nodes.size() );
|
||||||
for ( size_t i = 0; i < nodes.size(); ++i )
|
for ( size_t i = 0; i < nodes.size(); ++i )
|
||||||
uv[ i ] = helper.GetNodeUV( F, nodes[ i ], inFaceNode );
|
uv[ i ] = helper.GetNodeUV( F, nodes[ i ], inFaceNode );
|
||||||
@ -989,10 +1000,15 @@ namespace {
|
|||||||
SMESH_MeshEditor:: SmoothMethod algo =
|
SMESH_MeshEditor:: SmoothMethod algo =
|
||||||
isConcaveBoundary ? SMESH_MeshEditor::CENTROIDAL : SMESH_MeshEditor::LAPLACIAN;
|
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
|
// smoothing
|
||||||
set<const SMDS_MeshNode*> fixedNodes;
|
set<const SMDS_MeshNode*> fixedNodes;
|
||||||
editor.Smooth( faces, fixedNodes, algo, /*nbIterations=*/ 10,
|
editor.Smooth( faces, fixedNodes, algo, /*nbIterations=*/ 10,
|
||||||
/*theTgtAspectRatio=*/1.0, /*the2D=*/false);
|
/*theTgtAspectRatio=*/1.0, /*the2D=*/!isPlanar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user