mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-28 23:05:36 +05:00
try to cope with invalid node params on edges
This commit is contained in:
parent
3a53c225bc
commit
ce4982ab11
@ -32,13 +32,13 @@ using namespace std;
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <Extrema_ExtPC.hxx>
|
||||
#include <Extrema_GenExtPS.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
//#include <IntAna2d_AnaIntersection.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
@ -655,9 +655,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
||||
TopoDS_Edge & edge = *elIt;
|
||||
list< TPoint* > & ePoints = getShapePoints( edge );
|
||||
double f, l;
|
||||
Handle(Geom2d_Curve) C2d;
|
||||
if ( !theProject )
|
||||
C2d = BRep_Tool::CurveOnSurface( edge, face, f, l );
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface( edge, face, f, l );
|
||||
bool isForward = ( edge.Orientation() == TopAbs_FORWARD );
|
||||
|
||||
TopoDS_Shape v1 = TopExp::FirstVertex( edge, true ); // always FORWARD
|
||||
@ -733,7 +731,30 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
||||
const SMDS_EdgePosition* epos =
|
||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||
double u = epos->GetUParameter();
|
||||
paramNodeMap.insert( TParamNodeMap::value_type( u, node ));
|
||||
paramNodeMap.insert( make_pair( u, node ));
|
||||
}
|
||||
if ( paramNodeMap.size() != eSubMesh->NbNodes() ) {
|
||||
// wrong U on edge, project
|
||||
Extrema_ExtPC proj;
|
||||
BRepAdaptor_Curve aCurve( edge );
|
||||
proj.Initialize( aCurve, f, l );
|
||||
paramNodeMap.clear();
|
||||
nIt = eSubMesh->GetNodes();
|
||||
for ( int iNode = 0; nIt->more(); ++iNode ) {
|
||||
const SMDS_MeshNode* node = smdsNode( nIt->next() );
|
||||
proj.Perform( gp_Pnt( node->X(), node->Y(), node->Z()));
|
||||
double u = 0;
|
||||
if ( proj.IsDone() ) {
|
||||
for ( int i = 1, nb = proj.NbExt(); i <= nb; ++i )
|
||||
if ( proj.IsMin( i )) {
|
||||
u = proj.Point( i ).Parameter();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
u = isForward ? iNode : eSubMesh->NbNodes() - iNode;
|
||||
}
|
||||
paramNodeMap.insert( make_pair( u, node ));
|
||||
}
|
||||
}
|
||||
// put U in [0,1] so that the first key-point has U==0
|
||||
double du = l - f;
|
||||
|
Loading…
Reference in New Issue
Block a user