- nbN = innerNodes.size() - ( hasRightNode || hasOwnRightNode || !isShrinkableR);
- L._leftNodes .reserve( _hyp->GetNumberLayers() );
- L._rightNodes.reserve( _hyp->GetNumberLayers() );
- int cur = 0, prev = -1; // to take into account orientation of _face
- if ( isReverse ) std::swap( cur, prev );
- for ( int iF = 0; iF < _hyp->GetNumberLayers(); ++iF ) // loop on layers of faces
+ iNE = nbN - ( hasRightNode || hasOwnRightNode || !isShrinkableR );
+
+ // update _uvIn of end _LayerEdge's by existing nodes
+ const SMDS_MeshNode *nL = 0, *nR = 0;
+ if ( hasOwnLeftNode ) nL = L._leftNodes.back();
+ else if ( hasLeftNode ) nL = L._leftLine->_rightNodes.back();
+ if ( hasOwnRightNode ) nR = L._rightNodes.back();
+ else if ( hasRightNode ) nR = L._rightLine->_leftNodes.back();
+ if ( nL )
+ L._lEdges[0]._uvIn = _helper.GetNodeUV( _face, nL, points[ L._firstPntInd + 1 ].node );
+ if ( nR )
+ L._lEdges.back()._uvIn = _helper.GetNodeUV( _face, nR, points[ L._lastPntInd - 1 ].node );
+
+ // compute normalized [0;1] node parameters of nodes on a _PolyLine
+ vector< double > normPar( nbN );
+ const double
+ normF = L._wire->FirstParameter( L._edgeInd ),
+ normL = L._wire->LastParameter ( L._edgeInd ),
+ normDist = normL - normF;
+ for ( int i = L._firstPntInd; i <= L._lastPntInd; ++i )
+ normPar[ i - L._firstPntInd ] = ( points[i].normParam - normF ) / normDist;
+
+ // Calculate UV of most inner nodes
+
+ vector< gp_XY > innerUV( nbN );
+
+ // check if innerUV should be interpolated between _LayerEdge::_uvIn's
+ const size_t nbLE = L._lEdges.size();
+ bool needInterpol = ( nbN != nbLE );
+ if ( !needInterpol )
+ {
+ // more check: compare length of inner and outer end segments
+ double lenIn, lenOut;
+ for ( int isR = 0; isR < 2 && !needInterpol; ++isR )
+ {
+ const _Segment& segIn = isR ? L._segments.back() : L._segments[0];
+ const gp_XY& uvIn1 = segIn.p1();
+ const gp_XY& uvIn2 = segIn.p2();
+ const gp_XY& uvOut1 = L._lEdges[ isR ? nbLE-1 : 0 ]._uvOut;
+ const gp_XY& uvOut2 = L._lEdges[ isR ? nbLE-2 : 1 ]._uvOut;
+ if ( _is2DIsotropic )
+ {
+ lenIn = ( uvIn1 - uvIn2 ).Modulus();
+ lenOut = ( uvOut1 - uvOut2 ).Modulus();
+ }
+ else
+ {
+ lenIn = _surface->Value( uvIn1.X(), uvIn1.Y() )
+ .Distance( _surface->Value( uvIn2.X(), uvIn2.Y() ));
+ lenOut = _surface->Value( uvOut1.X(), uvOut1.Y() )
+ .Distance( _surface->Value( uvOut2.X(), uvOut2.Y() ));
+ }
+ needInterpol = ( lenIn < 0.66 * lenOut );
+ }
+ }
+
+ if ( needInterpol )