From: eap Date: Fri, 24 Apr 2015 12:51:19 +0000 (+0300) Subject: 23050: EDF 10631 SMESH: Nodes outside the plane after ConvertToQuadratic X-Git-Tag: V7_6_0rc1~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0b1674e3557c3f2d5028b6f24e44a16b6e19bd2d;p=modules%2Fsmesh.git 23050: EDF 10631 SMESH: Nodes outside the plane after ConvertToQuadratic Fix regression of mesh_Quadratic_00/B4 IPAL0052709: Projection 1D2D creates faces at a wrong location. Problem: wrong gp_Trsf for partner faces Use gp_GTrsf insted of gp_Trsf --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 2ba354d20..22b28da7d 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -4985,9 +4985,9 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError, const_cast( pLink->_mediumNode )->setXYZ( p.X(), p.Y(), p.Z()); p.Coord( distXYZ[1], distXYZ[2], distXYZ[3] ); gp_XY uv( Precision::Infinite(), 0 ); - faceHlp.CheckNodeUV( TopoDS::Face( faceHlp.GetSubShape() ), pLink->_mediumNode, - uv, /*tol=*/pLink->Move().Modulus(), /*force=*/true, distXYZ ); - p.SetCoord( distXYZ[1], distXYZ[2], distXYZ[3] ); + if ( faceHlp.CheckNodeUV( TopoDS::Face( faceHlp.GetSubShape() ), pLink->_mediumNode, + uv, /*tol=*/pLink->Move().Modulus(), /*force=*/true, distXYZ )) + p.SetCoord( distXYZ[1], distXYZ[2], distXYZ[3] ); } } GetMeshDS()->MoveNode( pLink->_mediumNode, p.X(), p.Y(), p.Z()); diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index 443ddc43c..a2f1047fe 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -2618,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; @@ -2715,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 ))); @@ -2745,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() ); } //================================================================================ /*! @@ -2760,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() ) { @@ -2771,7 +2771,7 @@ namespace StdMeshers_ProjectionUtils return false; } gp_Mat Minv = M.Inverted(); - _trsf.SetTranslation( _srcOrig ); + _trsf.SetTranslationPart( _srcOrig ); _srcOrig = newSrcOrig; M = Minv; } diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx index ea599b7a9..266918aaf 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -97,12 +97,12 @@ namespace StdMeshers_ProjectionUtils */ class TrsfFinder2D { - gp_Trsf2d _trsf; - gp_XY _srcOrig; + gp_GTrsf2d _trsf; + gp_XY _srcOrig; public: TrsfFinder2D(): _srcOrig(0,0) {} - void Set( const gp_Trsf2d& t ) { _trsf = t; } // it's an alternative to Solve() + void Set( const gp_GTrsf2d& t ) { _trsf = t; } // it's an alternative to Solve() bool Solve( const std::vector< gp_XY >& srcPnts, const std::vector< gp_XY >& tgtPnts ); @@ -117,12 +117,12 @@ namespace StdMeshers_ProjectionUtils */ class TrsfFinder3D { - gp_Trsf _trsf; - gp_XYZ _srcOrig; + gp_GTrsf _trsf; + gp_XYZ _srcOrig; public: TrsfFinder3D(): _srcOrig(0,0,0) {} - void Set( const gp_Trsf& t ) { _trsf = t; } // it's an alternative to Solve() + void Set( const gp_GTrsf& t ) { _trsf = t; } // it's an alternative to Solve() bool Solve( const std::vector< gp_XYZ > & srcPnts, const std::vector< gp_XYZ > & tgtPnts ); diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 853875c5d..b4496242a 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -60,6 +60,7 @@ #include #include #include +#include using namespace std; @@ -580,18 +581,24 @@ namespace { // transformation to get location of target nodes from source ones StdMeshers_ProjectionUtils::TrsfFinder3D trsf; + bool trsfIsOK = true; if ( tgtFace.IsPartner( srcFace )) { - gp_Trsf srcTrsf = srcFace.Location(); - gp_Trsf tgtTrsf = tgtFace.Location(); - trsf.Set( srcTrsf.Inverted() * tgtTrsf ); + gp_GTrsf srcTrsf = srcFace.Location().Transformation(); + gp_GTrsf tgtTrsf = tgtFace.Location().Transformation(); + gp_GTrsf t = srcTrsf.Inverted().Multiplied( tgtTrsf ); + trsf.Set( t ); // check gp_Pnt srcP = BRep_Tool::Pnt( srcWires[0]->FirstVertex() ); gp_Pnt tgtP = BRep_Tool::Pnt( tgtWires[0]->FirstVertex() ); - if ( tgtP.Distance( trsf.Transform( srcP )) > tol ) - trsf.Set( tgtTrsf.Inverted() * srcTrsf ); + trsfIsOK = ( tgtP.Distance( trsf.Transform( srcP )) < tol ); + if ( !trsfIsOK ) + { + trsf.Set( tgtTrsf.Inverted().Multiplied( srcTrsf )); + trsfIsOK = ( tgtP.Distance( trsf.Transform( srcP )) < tol ); + } } - else + if ( !trsfIsOK ) { // Try to find the 3D transformation @@ -626,7 +633,6 @@ namespace { // check trsf - bool trsfIsOK = true; const int nbTestPnt = 20; const size_t iStep = Max( 1, int( srcPnts.size() / nbTestPnt )); // check boundary