Fix smesh/imps_09/K0

Fix for zero-width slot
This commit is contained in:
eap 2019-10-11 19:13:54 +03:00
parent 2a1407f46f
commit d66fe4a500
2 changed files with 19 additions and 7 deletions

View File

@ -153,7 +153,12 @@ namespace
if ( myCuts[ iC1 ][ iP1 ].SquareDistance( myCuts[ iC2 ][ iP2 ]) < tol * tol ) if ( myCuts[ iC1 ][ iP1 ].SquareDistance( myCuts[ iC2 ][ iP2 ]) < tol * tol )
{ {
nbShared += 2; nbShared += 2;
isSharedPnt[ i1 ] = isSharedPnt[ i2 ] = true; if ( myCuts[ iC1 ][ 0 ].SquareDistance( myCuts[ iC1 ][ 1 ]) < tol * tol )
isSharedPnt[ iC1 * 2 ] = isSharedPnt[ iC1 * 2 + 1 ] = true;
else if ( myCuts[ iC2 ][ 0 ].SquareDistance( myCuts[ iC2 ][ 1 ]) < tol * tol )
isSharedPnt[ iC2 * 2 ] = isSharedPnt[ iC2 * 2 + 1 ] = true;
else
isSharedPnt[ i1 ] = isSharedPnt[ i2 ] = true;
} }
} }
} }
@ -565,6 +570,7 @@ SMESH_MeshAlgos::MakeSlot( SMDS_ElemIteratorPtr theSegmentIt,
// --------------------------------- // ---------------------------------
const double tol = Precision::Confusion(); const double tol = Precision::Confusion();
const double angularTol = 1e-5;
std::vector< gp_XYZ > faceNormals; std::vector< gp_XYZ > faceNormals;
SMESH_MeshAlgos::Intersector meshIntersector( theMesh, tol, faceNormals ); SMESH_MeshAlgos::Intersector meshIntersector( theMesh, tol, faceNormals );
std::unique_ptr< SMESH_ElementSearcher> faceSearcher; std::unique_ptr< SMESH_ElementSearcher> faceSearcher;
@ -725,7 +731,7 @@ SMESH_MeshAlgos::MakeSlot( SMDS_ElemIteratorPtr theSegmentIt,
if ( intPoints.size() == 2 ) if ( intPoints.size() == 2 )
toCut = true; toCut = true;
else if ( isCylinderOnFace ) else if ( isCylinderOnFace )
toCut = cylAxis.Direction().IsParallel( edegDir, tol ); toCut = cylAxis.Direction().IsParallel( edegDir, angularTol );
else else
{ {
SMESH_NodeXYZ nBetween; SMESH_NodeXYZ nBetween;

View File

@ -350,7 +350,7 @@ bool Triangulate::triangulate( std::vector< const SMDS_MeshNode*>& nodes,
// connect nodes into a ring // connect nodes into a ring
_pv.resize( nbNodes ); _pv.resize( nbNodes );
for ( size_t i = 1; i < nbNodes; ++i ) for ( size_t i = 1; i < nbNodes; ++i )
_pv[i-1].SetNodeAndNext( nodes[i-1], _pv[i], i-1 ); _pv[i-1].SetNodeAndNext( nodes[i-1], _pv[i], /*index=*/i-1 );
_pv[ nbNodes-1 ].SetNodeAndNext( nodes[ nbNodes-1 ], _pv[0], nbNodes-1 ); _pv[ nbNodes-1 ].SetNodeAndNext( nodes[ nbNodes-1 ], _pv[0], nbNodes-1 );
// assure correctness of PolyVertex::_index as a node can encounter more than once // assure correctness of PolyVertex::_index as a node can encounter more than once
@ -383,17 +383,23 @@ bool Triangulate::triangulate( std::vector< const SMDS_MeshNode*>& nodes,
catch ( Standard_Failure ) { catch ( Standard_Failure ) {
return false; return false;
} }
double factor = 1.0, modulus = normal.Modulus();
if ( modulus < 1e-2 )
factor = 1. / sqrt( modulus );
for ( size_t i = 0; i < nbNodes; ++i ) for ( size_t i = 0; i < nbNodes; ++i )
{ {
gp_XYZ p = _pv[i]._nxyz - p0; gp_XYZ p = _pv[i]._nxyz - p0;
_pv[i]._xy.SetX( axes.XDirection().XYZ() * p ); _pv[i]._xy.SetX( axes.XDirection().XYZ() * p * factor);
_pv[i]._xy.SetY( axes.YDirection().XYZ() * p ); _pv[i]._xy.SetY( axes.YDirection().XYZ() * p * factor );
} }
// compute minimal triangle area // compute minimal triangle area
double sumArea = 0; double sumArea = 0;
for ( size_t i = 0; i < nbNodes; ++i ) if ( factor == 1.0 )
sumArea += _pv[i].TriaArea(); sumArea = modulus;
else
for ( size_t i = 0; i < nbNodes; ++i )
sumArea += _pv[i].TriaArea();
const double minArea = 1e-6 * sumArea / ( nbNodes - 2 ); const double minArea = 1e-6 * sumArea / ( nbNodes - 2 );
// in a loop, find triangles with positive area and having no vertices inside // in a loop, find triangles with positive area and having no vertices inside