- Reverse( edges2 , *nbEInW, distance( edges2.begin(),edge2Beg ));
- // set correct edge2End
- edge2End = edges2.begin();
- std::advance( edge2End, std::accumulate( nbEInW1.begin(), nbEInW, *nbEInW));
+ // rotate edge2 untill coincidence with edge1 in 2D
+ int i = *nbE2;
+ while ( i-- > 0 && !sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV ))
+ // move edge2Beg to place before edge2End
+ edges2.splice( edge2End, edges2, edge2Beg++ );
+
+ if ( sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV ))
+ {
+ if ( iW1 == 0 ) OK = true; // OK is for the first wire
+ // reverse edges2 if needed
+ if ( !sameVertexUV( *edge2Beg, face2, 1, v1f1UV, vTolUV ))
+ Reverse( edges2 , *nbE2, std::distance( edges2.begin(),edge2Beg ));
+ // put wire2 at a right place within edges2
+ if ( iW1 != iW2 ) {
+ list< TopoDS_Edge >::iterator place2 = edges2.begin();
+ std::advance( place2, std::distance( edges1.begin(), edge1Beg ));
+ edges2.splice( place2, edges2, edge2Beg, edge2End );
+ // move nbE2 as well
+ list< int >::iterator placeNbE2 = nbEInW2.begin();
+ std::advance( placeNbE2, iW1 );
+ nbEInW2.splice( placeNbE2, nbEInW2, nbE2 );
+ }
+ break;
+ }