+ if ( !isIn ) // if all nodes are on FACE boundary, a mesh face can be OUT
+ {
+ // check state of nodes created for other faces
+ for ( size_t i = 0; i < nodeState.size() && !isIn; ++i )
+ {
+ if ( nodeState[i] != TopAbs_UNKNOWN ) continue;
+ gp_XY uv = helper.GetNodeUV( geomFace, newNodes[i] );
+ classifier.Perform( geomFace, uv, clsfTol );
+ nodeState[i] = classifier.State();
+ isIn = ( nodeState[i] == TopAbs_IN );
+ }
+ if ( !isIn ) // classify face center
+ {
+ gp_XYZ gc( 0., 0., 0 );
+ for ( size_t i = 0; i < newNodes.size(); ++i )
+ gc += SMESH_TNodeXYZ( newNodes[i] );
+ gc /= newNodes.size();
+
+ TopLoc_Location loc;
+ GeomAPI_ProjectPointOnSurf& proj = helper.GetProjector( geomFace,
+ loc,
+ helper.MaxTolerance( geomFace ));
+ if ( !loc.IsIdentity() ) loc.Transformation().Inverted().Transforms( gc );
+ proj.Perform( gc );
+ if ( !proj.IsDone() || proj.NbPoints() < 1 )
+ continue;
+ Quantity_Parameter U,V;
+ proj.LowerDistanceParameters(U,V);
+ gp_XY uv( U,V );
+ classifier.Perform( geomFace, uv, clsfTol );
+ if ( classifier.State() != TopAbs_IN )
+ continue;
+ }
+ }
+