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
This commit is contained in:
eap 2015-04-24 15:51:19 +03:00
parent e29c1bb636
commit 0b1674e355
4 changed files with 33 additions and 27 deletions

View File

@ -4985,9 +4985,9 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
const_cast<SMDS_MeshNode*>( 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());

View File

@ -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;
}

View File

@ -36,8 +36,8 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp_Trsf.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_GTrsf.hxx>
#include <gp_GTrsf2d.hxx>
#include <list>
#include <map>
@ -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 );

View File

@ -60,6 +60,7 @@
#include <TopoDS.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_GTrsf.hxx>
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