+ typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*,
+ TIDCompare> TNodeNodeMap;
+
+
+ /*!
+ * \brief Finds transformation between two sets of 2D points using
+ * a least square approximation
+ */
+ class TrsfFinder2D
+ {
+ gp_GTrsf2d _trsf;
+ gp_XY _srcOrig;
+ public:
+ TrsfFinder2D(): _srcOrig(0,0) {}
+
+ 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 );
+
+ gp_XY Transform( const gp_Pnt2d& srcUV ) const;
+
+ bool IsIdentity() const { return ( _trsf.Form() == gp_Identity ); }
+ };
+ /*!
+ * \brief Finds transformation between two sets of 3D points using
+ * a least square approximation
+ */
+ class TrsfFinder3D
+ {
+ gp_GTrsf _trsf;
+ gp_XYZ _srcOrig;
+ public:
+ TrsfFinder3D(): _srcOrig(0,0,0) {}
+
+ 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 );
+
+ gp_XYZ Transform( const gp_Pnt& srcP ) const;
+
+ gp_XYZ TransformVec( const gp_Vec& v ) const;
+
+ bool IsIdentity() const { return ( _trsf.Form() == gp_Identity ); }
+
+ bool Invert();
+ };
+
+ /*!
+ * \brief Morph mesh on the target FACE to lie within FACE boundary w/o distortion
+ */
+ class Morph
+ {
+ std::vector< const SMDS_MeshNode* > _bndSrcNodes;
+ Handle(BRepMesh_DataStructureOfDelaun) _triaDS;
+ SMESH_subMesh* _srcSubMesh;
+ bool _moveAll;
+ gp_XY _scale;
+ public:
+
+ Morph(const TSideVector& srcWires);
+
+ bool Perform(SMESH_MesherHelper& tgtHelper,
+ const TSideVector& tgtWires,
+ Handle(ShapeAnalysis_Surface) tgtSurface,
+ const TNodeNodeMap& src2tgtNodes,
+ const bool moveAll);
+
+ // return source boundary nodes. 0-th node is zero
+ const std::vector< const SMDS_MeshNode* >& GetBndNodes() const { return _bndSrcNodes; }
+
+ // return UV of the i-th source boundary node
+ gp_XY GetBndUV(const int iNode) const;
+ };