int shapeID = n->getshapeId();
bool infinit = Precision::IsInfinite( u );
bool zero = ( u == 0. );
- if ( force || toCheckPosOnShape( shapeID ) || infinit || zero )
+ if ( force || infinit || zero || toCheckPosOnShape( shapeID ))
{
TopLoc_Location loc; double f,l;
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
gp_Pnt nodePnt = SMESH_TNodeXYZ( n );
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
gp_Pnt curvPnt;
- double dist = u;
+ double dist = 2*tol;
if ( !infinit )
{
curvPnt = curve->Value( u );
//=======================================================================
//function : IsStructured
-//purpose : Return true if 2D mesh on FACE is structured
+//purpose : Return true if 2D mesh on FACE is a structured rectangle
//=======================================================================
bool SMESH_MesherHelper::IsStructured( SMESH_subMesh* faceSM )
//purpose : Return true if 2D mesh on FACE is ditorted
//=======================================================================
-bool SMESH_MesherHelper::IsDistorted2D( SMESH_subMesh* faceSM )
+bool SMESH_MesherHelper::IsDistorted2D( SMESH_subMesh* faceSM,
+ bool checkUV)
{
if ( !faceSM || faceSM->GetSubShape().ShapeType() != TopAbs_FACE )
return false;
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;
while ( faceIt->more() && !haveBadFaces )
{
const SMDS_MeshElement* face = faceIt->next();
// get UVs
uv.resize( nodes.size() );
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, 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;