double p4 = myFirst[i]+(myLast[i]-myFirst[i])/4.;
double d2 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p2 );
double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 );
- //cout<<"len = "<<len<<" d2 = "<<d2<<" fabs(2*d2/len-1.0) = "<<fabs(2*d2/len-1.0)<<endl;
myIsUniform[i] = !( fabs(2*d2/myEdgeLength[i]-1.0) > 0.01 || fabs(2*d4/d2-1.0) > 0.01 );
Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],d2,d4);
myC3dAdaptor[i].Load( C3d, d2,d4 );
const double theUFirst,
const double theULast)
{
+ myEdge.resize ( 1 );
+ myEdgeID.resize ( 1, 0 );
myC2d.push_back ( theC2d );
+ myC3dAdaptor.resize ( 1 );
myFirst.push_back ( theUFirst );
myLast.push_back ( theULast );
myNormPar.push_back ( 1. );
myIsUniform.push_back( true );
- myEdgeID.push_back ( 0 );
myLength = 0;
myProxyMesh = theSide->myProxyMesh;
myDefaultPnt2d = *thePnt2d1;
//================================================================================
StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
- const TopoDS_Face& theFace)
+ const TopoDS_Face& theFace,
+ const TopoDS_Edge& theEdge,
+ SMESH_Mesh* theMesh)
{
- myEdge.resize( 1 );
+ myEdge.resize( 1, theEdge );
myEdgeID.resize( 1, -1 );
myC2d.resize( 1 );
myC3dAdaptor.resize( 1 );
myIsUniform.resize( 1, 1 );
myMissingVertexNodes = myIgnoreMediumNodes = false;
myDefaultPnt2d.SetCoord( 1e100, 1e100 );
+ if ( theMesh ) myProxyMesh.reset( new SMESH_ProxyMesh( *theMesh ));
+ if ( !theEdge.IsNull() )
+ {
+ if ( theMesh ) myEdgeID[0] = theMesh->GetMeshDS()->ShapeToIndex( theEdge );
+ if ( theFace.IsNull() )
+ BRep_Tool::Range( theEdge, myFirst[0], myLast[0] );
+ else
+ myC2d[0] = BRep_Tool::CurveOnSurface( theEdge, theFace, myFirst[0], myLast[0] );
+ if ( theEdge.Orientation() == TopAbs_REVERSED )
+ std::swap( myFirst[0], myLast[0] );
+ }
myFace = theFace;
myPoints = theSideNodes;
if ( NbEdges() == 0 ) return myPoints;
StdMeshers_FaceSide* me = const_cast< StdMeshers_FaceSide* >( this );
- //SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
SMESH_MesherHelper eHelper( *myProxyMesh->GetMesh() );
SMESH_MesherHelper fHelper( *myProxyMesh->GetMesh() );
fHelper.SetSubShape( myFace );
else
{
node = VertexNode( iE );
- while ( !node && iE > 0 )
- node = VertexNode( --iE );
- if ( !node )
- return myPoints;
+ if ( myProxyMesh->GetMesh()->HasModificationsToDiscard() )
+ while ( !node && iE > 1 ) // check intermediate VERTEXes
+ node = VertexNode( --iE );
}
- if ( u2node.rbegin()->second == node &&
- !fHelper.IsRealSeam ( node->getshapeId() ) &&
- !fHelper.IsDegenShape( node->getshapeId() ))
- u2node.erase( --u2node.end() );
+ if ( node )
+ {
+ if ( u2node.rbegin()->second == node &&
+ !fHelper.IsRealSeam ( node->getshapeId() ) &&
+ !fHelper.IsDegenShape( node->getshapeId() ))
+ u2node.erase( --u2node.end() );
- u2node.insert( u2node.end(), make_pair( 1., node ));
+ u2node.insert( u2node.end(), make_pair( 1., node ));
+ }
}
if ((int) u2node.size() + nbProxyNodes != myNbPonits &&
(int) u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
{
- MESSAGE("Wrong node parameters on edges, u2node.size():"
- <<u2node.size()<<" != myNbPonits:"<<myNbPonits);
+ return myPoints;
+ }
+ if (( myNbPonits > 0 ) &&
+ ( u2node.begin()->first < 0 || u2node.rbegin()->first > 1 ))
+ {
return myPoints;
}
bool isXConst,
double constValue) const
{
- if ( myFalsePoints.empty() ) {
-
+ if ( myFalsePoints.empty() )
+ {
if ( NbEdges() == 0 ) return myFalsePoints;
vector<uvPtStruct>* points = const_cast<vector<uvPtStruct>*>( &myFalsePoints );
int EdgeIndex = 0;
double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
- for ( size_t i = 0 ; i < myFalsePoints.size(); ++i ) {
+ gp_Pnt2d p;
+ for ( size_t i = 0 ; i < myFalsePoints.size(); ++i )
+ {
double normPar = double(i) / double(nbSeg);
UVPtStruct & uvPt = (*points)[i];
uvPt.node = 0;
uvPt.x = uvPt.y = uvPt.param = uvPt.normParam = normPar;
if ( isXConst ) uvPt.x = constValue;
else uvPt.y = constValue;
- if ( myNormPar[ EdgeIndex ] < normPar ) {
+ if ( myNormPar[ EdgeIndex ] < normPar )
+ {
prevNormPar = myNormPar[ EdgeIndex ];
++EdgeIndex;
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
}
double r = ( normPar - prevNormPar )/ paramSize;
uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
- if ( !myC2d[ EdgeIndex ].IsNull() ) {
- gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
- uvPt.u = p.X();
- uvPt.v = p.Y();
- }
- else {
- uvPt.u = uvPt.v = 1e+100;
- }
+ if ( !myC2d[ EdgeIndex ].IsNull() )
+ p = myC2d[ EdgeIndex ]->Value( uvPt.param );
+ else
+ p = Value2d( normPar );
+ uvPt.u = p.X();
+ uvPt.v = p.Y();
}
}
return myFalsePoints;