Salome HOME
Update translation files from Crowdin
[modules/smesh.git] / src / StdMeshers / StdMeshers_ProjectionUtils.cxx
index a21f5d7aa26b1986e6cbccc706a138ef5df5d70c..a2f1047fee303e3cd02dd641433547b4cd75b82e 100644 (file)
@@ -756,6 +756,10 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
           TopoDS_Face nextFace1 = GetNextFace( edgeToFace1, *eIt1, face1 );
           TopoDS_Face nextFace2 = GetNextFace( edgeToFace2, *eIt2, face2 );
           if ( !nextFace1.IsNull() && !nextFace2.IsNull() ) {
+            if ( SMESH_MesherHelper::GetSubShapeOri( nextFace1, *eIt1 ) == eIt1->Orientation() )
+              nextFace1.Reverse();
+            if ( SMESH_MesherHelper::GetSubShapeOri( nextFace2, *eIt2 ) == eIt2->Orientation() )
+              nextFace2.Reverse();
             FE1.push_back( make_pair( nextFace1, *eIt1 ));
             FE2.push_back( make_pair( nextFace2, *eIt2 ));
           }
@@ -1170,11 +1174,11 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       if ( !VV1[1].IsNull() ) {
         InsertAssociation( VV1[0], VV2[0], theMap );
         InsertAssociation( VV1[1], VV2[1], theMap );
+        TShapeShapeMap::EAssocType asType = theMap._assocType;
+        theMap.SetAssocType( TShapeShapeMap::PROPAGATION );
         if ( FindSubShapeAssociation( theShape1, theMesh1, theShape2, theMesh2, theMap ))
-        {
-          theMap.SetAssocType( TShapeShapeMap::PROPAGATION );
           return true;
-        }
+        theMap._assocType = asType;
       }
     }
     break; // try by vertex closeness
@@ -1230,11 +1234,11 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       {
         InsertAssociation( VV1[0], VV1[0], theMap );
         InsertAssociation( VV1[1], VV1[1], theMap );
-        if (FindSubShapeAssociation( theShape1, theMesh1, theShape2, theMesh2, theMap ))
-        {
-          theMap.SetAssocType( TShapeShapeMap::COMMON_VERTEX );
+        TShapeShapeMap::EAssocType asType = theMap._assocType;
+        theMap.SetAssocType( TShapeShapeMap::COMMON_VERTEX );
+        if ( FindSubShapeAssociation( theShape1, theMesh1, theShape2, theMesh2, theMap ))
           return true;
-        }
+        theMap._assocType = asType;
       }
     }
   }
@@ -1406,7 +1410,7 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
       }
       if ( TopExp::FirstVertex( *edgeIt ).IsSame( TopExp::LastVertex( *edgeIt )) &&
            SMESH_Algo::isDegenerated( *edgeIt )) {
-        --edgeIt; // skip a degenerated edge (www.salome-platform.org/forum/forum_11/173031193)
+        --edgeIt; // skip a degenerated edge (test 3D_mesh_Projection_00/A3)
       }
       if ( !VV1[1].IsSame( TopExp::FirstVertex( *edgeIt, true ))) {
         CONT_BAD_RESULT("GetOrderedEdges() failed");
@@ -1593,20 +1597,21 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
               // reverse edges2 if needed
               if ( SMESH_MesherHelper::IsClosedEdge( *edge1Beg ))
               {
-                double f,l;
-                Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface( *edge1Beg, face1,f,l );
-                if (  edge1Beg->Orientation() == TopAbs_REVERSED )
-                  std::swap( f,l );
-                gp_Pnt2d uv1 = dUV + c1->Value( f * 0.8 + l * 0.2 ).XY();
-
-                Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface( *edge2Beg, face2,f,l );
-                if (  edge2Beg->Orientation() == TopAbs_REVERSED )
-                  std::swap( f,l );
-                gp_Pnt2d uv2 = c2->Value( f * 0.8 + l * 0.2 );
-                gp_Pnt2d uv3 = c2->Value( l * 0.8 + f * 0.2 );
-
-                if ( uv1.SquareDistance( uv2 ) > uv1.SquareDistance( uv3 ))
-                  edge2Beg->Reverse();
+                // Commented (so far?) as it's not checked if orientation must be same or reversed
+                // double f,l;
+                // Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface( *edge1Beg, face1,f,l );
+                // if (  edge1Beg->Orientation() == TopAbs_REVERSED )
+                //   std::swap( f,l );
+                // gp_Pnt2d uv1 = dUV + c1->Value( f * 0.8 + l * 0.2 ).XY();
+
+                // Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface( *edge2Beg, face2,f,l );
+                // if (  edge2Beg->Orientation() == TopAbs_REVERSED )
+                //   std::swap( f,l );
+                // gp_Pnt2d uv2 = c2->Value( f * 0.8 + l * 0.2 );
+                // gp_Pnt2d uv3 = c2->Value( l * 0.8 + f * 0.2 );
+
+                // if ( uv1.SquareDistance( uv2 ) > uv1.SquareDistance( uv3 ))
+                //   edge2Beg->Reverse();
               }
               else
               {
@@ -2613,13 +2618,13 @@ namespace StdMeshers_ProjectionUtils
     // cout << vec( 1 ) << "\t " << vec( 2 ) << endl
     //      << vec( 3 ) << "\t " << vec( 4 ) << endl;
 
-    _trsf.SetTranslation( tgtGC );
+    _trsf.SetTranslationPart( tgtGC );
     _srcOrig = srcGC;
 
-    gp_Mat2d& M = const_cast< gp_Mat2d& >( _trsf.HVectorialPart());
+    gp_Mat2d& M = const_cast< gp_Mat2d& >( _trsf.VectorialPart());
     M( 1,1 ) = vec( 1 );
-    M( 2,1 ) = vec( 2 );
-    M( 1,2 ) = vec( 3 );
+    M( 2,1 ) = vec( 2 ); // | 1 3 | -- is it correct ????????
+    M( 1,2 ) = vec( 3 ); // | 2 4 |
     M( 2,2 ) = vec( 4 );
 
     return true;
@@ -2710,9 +2715,9 @@ namespace StdMeshers_ProjectionUtils
     //      << vec( 7 ) << "\t " << vec( 8 ) << "\t " << vec( 9 ) << endl;
 
     _srcOrig = srcOrig;
-    _trsf.SetTranslation( tgtOrig );
+    _trsf.SetTranslationPart( tgtOrig );
 
-    gp_Mat& M = const_cast< gp_Mat& >( _trsf.HVectorialPart() );
+    gp_Mat& M = const_cast< gp_Mat& >( _trsf.VectorialPart() );
     M.SetRows( gp_XYZ( vec( 1 ), vec( 2 ), vec( 3 )),
                gp_XYZ( vec( 4 ), vec( 5 ), vec( 6 )),
                gp_XYZ( vec( 7 ), vec( 8 ), vec( 9 )));
@@ -2740,7 +2745,7 @@ namespace StdMeshers_ProjectionUtils
 
   gp_XYZ TrsfFinder3D::TransformVec( const gp_Vec& v ) const
   {
-    return v.XYZ().Multiplied( _trsf.HVectorialPart() );
+    return v.XYZ().Multiplied( _trsf.VectorialPart() );
   }
   //================================================================================
   /*!
@@ -2755,7 +2760,7 @@ namespace StdMeshers_ProjectionUtils
     {
       // seems to be defined via Solve()
       gp_XYZ newSrcOrig = _trsf.TranslationPart();
-      gp_Mat& M = const_cast< gp_Mat& >( _trsf.HVectorialPart() );
+      gp_Mat& M = const_cast< gp_Mat& >( _trsf.VectorialPart() );
       const double D = M.Determinant();
       if ( D < 1e-3 * ( newSrcOrig - _srcOrig ).Modulus() )
       {
@@ -2766,7 +2771,7 @@ namespace StdMeshers_ProjectionUtils
         return false;
       }
       gp_Mat Minv = M.Inverted();
-      _trsf.SetTranslation( _srcOrig );
+      _trsf.SetTranslationPart( _srcOrig );
       _srcOrig = newSrcOrig;
       M = Minv;
     }