using namespace std;
#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
+#ifdef _DEBUG_
+// enable printing algo + projection shapes while meshing
+//#define PRINT_WHO_COMPUTE_WHAT
+#endif
namespace TAssocTool = StdMeshers_ProjectionUtils;
//typedef StdMeshers_ProjectionUtils TAssocTool;
if (( err && !err->IsOK() ) ||
( srcWires.empty() ))
return err;
-
+#ifdef PRINT_WHO_COMPUTE_WHAT
+ cout << "Projection_2D" << " F "
+ << tgtMesh->GetMeshDS()->ShapeToIndex( tgtFace ) << " <- "
+ << srcMesh->GetMeshDS()->ShapeToIndex( srcFace ) << endl;
+#endif
SMESH_MesherHelper srcHelper( *srcMesh );
srcHelper.SetSubShape( srcFace );
for ( int iE = 0; iE < srcWire->NbEdges(); ++iE )
{
+#ifdef PRINT_WHO_COMPUTE_WHAT
+ if ( tgtMesh->GetSubMesh( tgtWire->Edge(iE) )->IsEmpty() )
+ cout << "Projection_2D" << " E "
+ << tgtWire->EdgeID(iE) << " <- " << srcWire->EdgeID(iE) << endl;
+#endif
if ( srcMesh->GetSubMesh( srcWire->Edge(iE) )->IsEmpty() ||
tgtMesh->GetSubMesh( tgtWire->Edge(iE) )->IsEmpty() )
{
tgtMeshDS->SetNodeOnEdge( n, tgtE, srcU );
if ( !tgtFace.IsPartner( srcFace ))
{
- bool isOk = true;
edgeHelper.SetSubShape( tgtE );
- edgeHelper.GetNodeU( tgtE, n, 0, &isOk );
+ double tol = BRep_Tool::Tolerance( tgtE );
+ bool isOk = edgeHelper.CheckNodeU( tgtE, n, srcU, 2 * tol, /*force=*/true );
if ( !isOk ) // projection of n to tgtE failed (23395)
{
double sF, sL, tF, tL;
tgtMeshDS->SetNodeOnEdge( n, tgtE, tgtU );
gp_Pnt newP = BRepAdaptor_Curve( tgtE ).Value( tgtU );
double dist = newP.Distance( tgtP );
- double tol = BRep_Tool::Tolerance( tgtE );
if ( tol < dist && dist < 1000*tol )
tgtMeshDS->MoveNode( n, newP.X(), newP.Y(), newP.Z() );
}