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());
// 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;
// << 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 )));
gp_XYZ TrsfFinder3D::TransformVec( const gp_Vec& v ) const
{
- return v.XYZ().Multiplied( _trsf.HVectorialPart() );
+ return v.XYZ().Multiplied( _trsf.VectorialPart() );
}
//================================================================================
/*!
{
// 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() )
{
return false;
}
gp_Mat Minv = M.Inverted();
- _trsf.SetTranslation( _srcOrig );
+ _trsf.SetTranslationPart( _srcOrig );
_srcOrig = newSrcOrig;
M = Minv;
}
#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>
*/
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 );
*/
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 );
#include <TopoDS.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
+#include <gp_GTrsf.hxx>
using namespace std;
// 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
// check trsf
- bool trsfIsOK = true;
const int nbTestPnt = 20;
const size_t iStep = Max( 1, int( srcPnts.size() / nbTestPnt ));
// check boundary