-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_Algo.hxx"
+#include "SMESH_Block.hxx"
+#include "SMESH_ComputeError.hxx"
#include "SMESH_Mesh.hxx"
+#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
-#include "SMESH_ComputeError.hxx"
-#include "SMESH_Block.hxx"
#include <Adaptor2d_Curve2d.hxx>
#include <BRepAdaptor_CompCurve.hxx>
myC3dAdaptor[i].Load( C3d, 0, 0.5 * BRep_Tool::Tolerance( V ));
}
}
+ else if ( myEdgeLength[i] > DBL_MIN )
+ {
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],myFirst[i], myLast[i] );
+ myC3dAdaptor[i].Load( C3d, myFirst[i], myLast[i] );
+ if ( myEdge[i].Orientation() == TopAbs_REVERSED )
+ std::swap( myFirst[i], myLast[i] );
+ }
+
// reverse a proxy sub-mesh
if ( !theIsForward )
reverseProxySubmesh( myEdge[i] );
} // loop on edges
+ // orient seam edges (#19982)
+ const double tol = Precision::Confusion();
+ if ( NbEdges() > 1 && !myC2d[0].IsNull() )
+ for ( int i = 0; i < NbEdges(); ++i )
+ {
+ int iPrev = SMESH_MesherHelper::WrapIndex( i - 1, NbEdges() );
+ if ( !BRep_Tool::IsClosed( myEdge[i], myFace ) || !myC2d[iPrev] )
+ continue;
+ gp_Pnt2d pLastPrev = myC2d[iPrev]->Value( myLast[iPrev] );
+ gp_Pnt2d pFirst = myC2d[i]->Value( myFirst[i] );
+ if ( pLastPrev.IsEqual( pFirst, tol ))
+ continue; // OK
+ pFirst = myC2d[i]->Value( myLast[i] );
+ if ( pLastPrev.IsEqual( pFirst, tol ))
+ {
+ std::swap( myFirst[i], myLast[i] );
+ continue;
+ }
+ TopoDS_Edge E = myEdge[i];
+ E.Reverse();
+ Handle(Geom2d_Curve) c2dRev = BRep_Tool::CurveOnSurface( E, myFace, myFirst[i], myLast[i] );
+ pFirst = c2dRev->Value( myFirst[i] );
+ if ( pLastPrev.IsEqual( pFirst, tol ))
+ {
+ myC2d[i] = c2dRev;
+ continue;
+ }
+ pFirst = c2dRev->Value( myLast[i] );
+ if ( pLastPrev.IsEqual( pFirst, tol ))
+ {
+ myC2d[i] = c2dRev;
+ std::swap( myFirst[i], myLast[i] );
+ }
+ }
+
// count nodes and segments
NbPoints( /*update=*/true );
for ( size_t j = 0; j < u2nodeVec.size(); ++j )
u2node.insert( u2node.end(), u2nodeVec[j] );
}
+ continue;
} // loop on myEdge's
// Add 2nd VERTEX node for a last EDGE
uvPt.normParam = u_node->first;
uvPt.x = uvPt.y = uvPt.normParam;
// -- U ----------------------------------------------
- const SMDS_EdgePosition* epos =
- dynamic_cast<const SMDS_EdgePosition*>(uvPt.node->GetPosition());
+ SMDS_EdgePositionPtr epos = uvPt.node->GetPosition();
if ( epos && uvPt.node->getshapeId() == myEdgeID[iE] ) {
uvPt.param = epos->GetUParameter();
}
iE = theEdgeInd % NbEdges();
iEnd = iE + 1;
}
- for ( iE = 0; iE < iEnd; ++iE )
+ for ( ; iE < iEnd; ++iE )
{
double prevNormPar = ( iE == 0 ? 0 : myNormPar[ iE-1 ]); // normalized param
// check parametrization of curve
if( !myIsUniform[i] )
{
- double aLen3dU = r * myEdgeLength[i] * ( myFirst[i]>myLast[i] ? -1. : 1.);
+ double aLen3dU = r * myEdgeLength[i] * ( myFirst[i] > myLast[i] ? -1. : 1. );
GCPnts_AbscissaPoint AbPnt
( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), aLen3dU, myFirst[i] );
if( AbPnt.IsDone() ) {