gp_XY LastUV( const TopoDS_Face& F, _EdgesOnShape& eos, int which=-1 ) const;
bool IsOnEdge() const { return _2neibors; }
bool IsOnFace() const { return ( _nodes[0]->GetPosition()->GetDim() == 2 ); }
+ int BaseShapeDim() const { return _nodes[0]->GetPosition()->GetDim(); }
gp_XYZ Copy( _LayerEdge& other, _EdgesOnShape& eos, SMESH_MesherHelper& helper );
void SetCosin( double cosin );
void SetNormal( const gp_XYZ& n ) { _normal = n; }
// Convex FACEs whose radius of curvature is less than the thickness of layers
map< TGeomID, _ConvexFace > _convexFaces;
- // shapes (EDGEs and VERTEXes) srink from which is forbidden due to collisions with
+ // shapes (EDGEs and VERTEXes) shrink from which is forbidden due to collisions with
// the adjacent SOLID
set< TGeomID > _noShrinkShapes;
}
- // Fill _eosC1 to make that C1 FACEs and EGDEs between them to be smoothed as a whole
+ // Fill _eosC1 to make that C1 FACEs and EDGEs between them to be smoothed as a whole
TopTools_MapOfShape c1VV;
//================================================================================
/*!
- * \brief DEBUG. Create groups contating temorary data of _LayerEdge's
+ * \brief DEBUG. Create groups containing temporary data of _LayerEdge's
*/
//================================================================================
{
#ifdef __myDEBUG
SMDS_MeshElement::iterator nIt = closestFace->begin_nodes();
- cout << "Shortest distance: _LayerEdge nodes: tgt " << le->_nodes.back()->GetID()
+ cout << "#Shortest distance: _LayerEdge nodes: tgt " << le->_nodes.back()->GetID()
<< " src " << le->_nodes[0]->GetID()<< ", intersection with face ("
<< (*nIt++)->GetID()<<" "<< (*nIt++)->GetID()<<" "<< (*nIt++)->GetID()
<< ") distance = " << distToIntersection<< endl;
src2->GetID() < edge->_nodes[0]->GetID() )
continue; // avoid using same segment twice
- // a _LayerEdge containg tgt2
+ // a _LayerEdge containing tgt2
_LayerEdge* neiborEdge = edge->_2neibors->_edges[j];
_TmpMeshFaceOnEdge* f = new _TmpMeshFaceOnEdge( edge, neiborEdge, --_tmpFaceID );
}
}
- // // this coice is done only if ( !concaveVertices.empty() ) for Grids/smesh/bugs_19/X1
+ // // this choice is done only if ( !concaveVertices.empty() ) for Grids/smesh/bugs_19/X1
// // where the nodes are smoothed too far along a sphere thus creating
// // inverted _simplices
// double dist[theNbSmooFuns];
int iSmoothed = GetSmoothedPos( tol );
if ( !iSmoothed ) return;
- //if ( 1 || Is( DISTORTED ))
+ gp_XYZ normal = _normal;
+ if ( Is( NORMAL_UPDATED ))
{
- gp_XYZ normal = _normal;
- if ( Is( NORMAL_UPDATED ))
+ double minDot = 1;
+ for ( size_t i = 0; i < _neibors.size(); ++i )
+ {
+ if ( _neibors[i]->IsOnFace() )
+ {
+ double dot = _normal * _neibors[i]->_normal;
+ if ( dot < minDot )
+ {
+ normal = _neibors[i]->_normal;
+ minDot = dot;
+ }
+ }
+ }
+ if ( minDot == 1. )
for ( size_t i = 1; i < _pos.size(); ++i )
{
normal = _pos[i] - _pos[0];
break;
}
}
- const double r = 0.2;
- for ( int iter = 0; iter < 50; ++iter )
+ }
+ const double r = 0.2;
+ for ( int iter = 0; iter < 50; ++iter )
+ {
+ double minDot = 1;
+ for ( size_t i = Max( 1, iSmoothed-1-iter ); i < _pos.size()-1; ++i )
{
- double minDot = 1;
- for ( size_t i = Max( 1, iSmoothed-1-iter ); i < _pos.size()-1; ++i )
- {
- gp_XYZ midPos = 0.5 * ( _pos[i-1] + _pos[i+1] );
- gp_XYZ newPos = ( 1-r ) * midPos + r * _pos[i];
- _pos[i] = newPos;
- double midLen = 0.5 * ( segLen[i-1] + segLen[i+1] );
- double newLen = ( 1-r ) * midLen + r * segLen[i];
- const_cast< double& >( segLen[i] ) = newLen;
- // check angle between normal and (_pos[i+1], _pos[i] )
- gp_XYZ posDir = _pos[i+1] - _pos[i];
- double size = posDir.SquareModulus();
- if ( size > RealSmall() )
- minDot = Min( minDot, ( normal * posDir ) * ( normal * posDir ) / size );
- }
- if ( minDot > 0.5 * 0.5 )
- break;
+ gp_XYZ midPos = 0.5 * ( _pos[i-1] + _pos[i+1] );
+ gp_XYZ newPos = ( 1-r ) * midPos + r * _pos[i];
+ _pos[i] = newPos;
+ double midLen = 0.5 * ( segLen[i-1] + segLen[i+1] );
+ double newLen = ( 1-r ) * midLen + r * segLen[i];
+ const_cast< double& >( segLen[i] ) = newLen;
+ // check angle between normal and (_pos[i+1], _pos[i] )
+ gp_XYZ posDir = _pos[i+1] - _pos[i];
+ double size = posDir.SquareModulus();
+ if ( size > RealSmall() )
+ minDot = Min( minDot, ( normal * posDir ) * ( normal * posDir ) / size );
}
+ if ( minDot > 0.5 * 0.5 )
+ break;
}
- // else
- // {
- // for ( size_t i = 1; i < _pos.size()-1; ++i )
- // {
- // if ((int) i < iSmoothed && ( segLen[i] / segLen.back() < 0.5 ))
- // continue;
-
- // double wgt = segLen[i] / segLen.back();
- // gp_XYZ normPos = _pos[0] + _normal * wgt * _len;
- // gp_XYZ tgtPos = ( 1 - wgt ) * _pos[0] + wgt * _pos.back();
- // gp_XYZ newPos = ( 1 - wgt ) * normPos + wgt * tgtPos;
- // _pos[i] = newPos;
- // }
- // }
+ return;
}
//================================================================================
vector< _EdgesOnShape* > subEOS;
vector< _LayerEdge* > lEdges;
- // loop on FACEs to srink mesh on
+ // loop on FACEs to shrink mesh on
map< TGeomID, list< _SolidData* > >::iterator f2sd = f2sdMap.begin();
for ( ; f2sd != f2sdMap.end(); ++f2sd )
{
if ( eos.SWOLType() == TopAbs_EDGE )
{
SMESH_subMesh* edgeSM = _mesh->GetSubMesh( eos._sWOL );
- _Shrinker1D& srinker = e2shrMap[ edgeSM->GetId() ];
- eShri1D.insert( & srinker );
- srinker.AddEdge( eos._edges[0], eos, helper );
+ _Shrinker1D& shrinker = e2shrMap[ edgeSM->GetId() ];
+ eShri1D.insert( & shrinker );
+ shrinker.AddEdge( eos._edges[0], eos, helper );
VISCOUS_3D::ToClearSubWithMain( edgeSM, data._solid );
- // restore params of nodes on EGDE if the EDGE has been already
- // srinked while srinking other FACE
- srinker.RestoreParams();
+ // restore params of nodes on EDGE if the EDGE has been already
+ // shrinked while shrinking other FACE
+ shrinker.RestoreParams();
}
for ( size_t i = 0; i < eos._edges.size(); ++i )
{
if ( data2 )
VISCOUS_3D::ToClearSubWithMain( sm, data2->_solid );
- } // loop on FACES to srink mesh on
+ } // loop on FACES to shrink mesh on
// Replace source nodes by target nodes in shrinked mesh edges
//================================================================================
/*!
- * \brief Try to fix triangles with high aspect ratio by swaping diagonals
+ * \brief Try to fix triangles with high aspect ratio by swapping diagonals
*/
//================================================================================