+ myDefaultPnt2d = *thePnt2d1;
+ myPoints = theSide->GetUVPtStruct();
+ myNbPonits = myPoints.size();
+ myNbSegments = theSide->myNbSegments;
+ if ( thePnt2d2 )
+ for ( size_t i = 0; i < myPoints.size(); ++i )
+ {
+ double r = i / ( myPoints.size() - 1. );
+ myPoints[i].u = (1-r) * thePnt2d1->X() + r * thePnt2d2->X();
+ myPoints[i].v = (1-r) * thePnt2d1->Y() + r * thePnt2d2->Y();
+ myPoints[i].node = theNode;
+ }
+ else
+ for ( size_t i = 0; i < myPoints.size(); ++i )
+ {
+ myPoints[i].u = thePnt2d1->X();
+ myPoints[i].v = thePnt2d1->Y();
+ myPoints[i].node = theNode;
+ }
+}
+
+//================================================================================
+/*
+ * Create a side from an UVPtStructVec
+ */
+//================================================================================
+
+StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
+ const TopoDS_Face& theFace)
+{
+ myEdge.resize( 1 );
+ myEdgeID.resize( 1, -1 );
+ myC2d.resize( 1 );
+ myC3dAdaptor.resize( 1 );
+ myFirst.resize( 1, 0. );
+ myLast.resize( 1, 1. );
+ myNormPar.resize( 1, 1. );
+ myIsUniform.resize( 1, 1 );
+ myMissingVertexNodes = myIgnoreMediumNodes = false;
+ myDefaultPnt2d.SetCoord( 1e100, 1e100 );
+
+ myPoints = theSideNodes;
+ myNbPonits = myPoints.size();
+ myNbSegments = myNbPonits + 1;
+
+ myLength = 0;
+ if ( !myPoints.empty() )
+ {
+ myPoints[0].normParam = 0;
+ if ( myPoints[0].node &&
+ myPoints.back().node &&
+ myPoints[ myNbPonits/2 ].node )
+ {
+ gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node );
+ for ( size_t i = 1; i < myPoints.size(); ++i )
+ {
+ gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node );
+ myLength += p.Distance( pPrev );
+ myPoints[i].normParam = myLength;
+ pPrev = p;
+ }
+ }
+ else if ( !theFace.IsNull() )
+ {
+ TopLoc_Location loc;
+ Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc );
+ gp_Pnt pPrev = surf->Value( myPoints[0].u, myPoints[0].v );
+ for ( size_t i = 1; i < myPoints.size(); ++i )
+ {
+ gp_Pnt p = surf->Value( myPoints[i].u, myPoints[i].v );
+ myLength += p.Distance( pPrev );
+ myPoints[i].normParam = myLength;
+ pPrev = p;
+ }
+ }
+ else
+ {
+ gp_Pnt2d pPrev = myPoints[0].UV();
+ for ( size_t i = 1; i < myPoints.size(); ++i )
+ {
+ gp_Pnt2d p = myPoints[i].UV();
+ myLength += p.Distance( pPrev );
+ myPoints[i].normParam = myLength;
+ pPrev = p;
+ }
+ }
+ if ( myLength > std::numeric_limits<double>::min() )
+ for ( size_t i = 1; i < myPoints.size(); ++i )
+ myPoints[i].normParam /= myLength;