X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_FaceSide.cxx;h=0c7c334f20cd7e4b1fbf33411756b737a3a01612;hp=53a8d5dc296aa565fc492e3ae2a65eeff20e7259;hb=b6e8c17211f3a65d729b5ffe7269c789a042ae24;hpb=466da2436e3a2de79c6c79edafc0d4cac819f839 diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 53a8d5dc2..0c7c334f2 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -195,12 +195,14 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const StdMeshers_FaceSide* theSide, 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; @@ -324,7 +326,6 @@ const std::vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXCons 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 ); @@ -429,24 +430,29 @@ const std::vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXCons 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():" - < 0 ) && + ( u2node.begin()->first < 0 || u2node.rbegin()->first > 1 )) + { return myPoints; } @@ -463,25 +469,39 @@ const std::vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXCons if ( proxySubMesh[ iE ] ) // copy data from a proxy sub-mesh { const UVPtStructVec& edgeUVPtStruct = proxySubMesh[iE]->GetUVPtStructVec(); - std::copy( edgeUVPtStruct.begin(), edgeUVPtStruct.end(), & points[iPt] ); + UVPtStruct* pointsPtr = & points[iPt]; + std::copy( edgeUVPtStruct.begin(), edgeUVPtStruct.end(), pointsPtr ); // check orientation double du1 = edgeUVPtStruct.back().param - edgeUVPtStruct[0].param; double du2 = myLast[iE] - myFirst[iE]; if ( du1 * du2 < 0 ) { - std::reverse( & points[iPt], & points[iPt + edgeUVPtStruct.size()]); + std::reverse( pointsPtr, pointsPtr + edgeUVPtStruct.size()); for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i ) - points[iPt+i].normParam = 1. - points[iPt+i].normParam; + pointsPtr[i].normParam = 1. - pointsPtr[i].normParam; } // update normalized params if ( myEdge.size() > 1 ) { - for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i, ++iPt ) + for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i ) { - UVPtStruct & uvPt = points[iPt]; + UVPtStruct & uvPt = pointsPtr[i]; uvPt.normParam = prevNormPar + uvPt.normParam * paramSize; uvPt.x = uvPt.y = uvPt.normParam; } - --iPt; // to point to the 1st VERTEX of the next EDGE + iPt += edgeUVPtStruct.size() - 1; // to point to the 1st VERTEX of the next EDGE + } + // update UV on a seam EDGE + if ( fHelper.IsRealSeam( myEdgeID[ iE ])) + { + // check if points lye on the EDGE + const UVPtStruct& pm = edgeUVPtStruct[ edgeUVPtStruct.size()/2 ]; + gp_Pnt pNode = SMESH_TNodeXYZ( pm.node ); + gp_Pnt pCurv = myC3dAdaptor[ iE ].Value( pm.param ); + double tol = BRep_Tool::Tolerance( myEdge[ iE ]) * 10; + bool isPointOnEdge = ( pNode.SquareDistance( pCurv ) < tol * tol ); + if ( isPointOnEdge ) + for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i ) + pointsPtr[i].SetUV( myC2d[ iE ]->Value( pointsPtr[i].param ).XY() ); } } else @@ -489,7 +509,7 @@ const std::vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXCons for ( ; u_node != u2node.end(); ++u_node, ++iPt ) { if ( myNormPar[ iE ]-eps < u_node->first ) - break; // u_node is at VERTEX of the next EDGE + break; // u_node is at VERTEX of the next EDGE UVPtStruct & uvPt = points[iPt]; uvPt.node = u_node->second;