X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_ProjectionUtils.cxx;h=8d198fe6955d095eab59464a1c4a7757004a94f6;hb=7348db21e56430da33bc877c7d46e2c4eecfd66c;hp=d0f29a54bb66dbc9ddebdcd549e4a62baa39bbd4;hpb=02c33dab509eb6c8e56e39f4ca720131936e89bf;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index d0f29a54b..8d198fe69 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -1237,6 +1237,7 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1, { bool OK = false; list< int > nbEInW1, nbEInW2; + list< TopoDS_Edge >::iterator edgeIt; int i_ok_wire_algo = -1; for ( int outer_wire_algo = 0; outer_wire_algo < 2 && !OK; ++outer_wire_algo ) { @@ -1257,7 +1258,6 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1, bool reverse = false; - list< TopoDS_Edge >::iterator edgeIt; if ( !VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) { reverse = true; edgeIt = --edges1.end(); @@ -1367,6 +1367,27 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1, } } + const int nbEdges = nbEInW1.front(); + if ( OK && nbEdges == 2 ) + { + // if a wire includes 2 edges, it's impossible to associate them using + // topological information only. Try to use length of edges for association. + double l1[2], l2[2]; + edgeIt = edges1.begin(); + l1[0] = SMESH_Algo::EdgeLength( *edgeIt++ ); + l1[1] = SMESH_Algo::EdgeLength( *edgeIt++ ); + if ( Abs( l1[0] - l1[1] ) > 0.1 * Max( l1[0], l1[1] ) ) + { + edgeIt = edges2.begin(); + l2[0] = SMESH_Algo::EdgeLength( *edgeIt++ ); + l2[1] = SMESH_Algo::EdgeLength( *edgeIt++ ); + if (( l1[0] < l1[1] ) != ( l2[0] < l2[1] )) + { + Reverse( edges2, nbEdges ); + } + } + } + return OK ? nbEInW1.front() : 0; }