- if(IsMedium)
- continue;
- const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
- double param = epos->GetUParameter();
- params[param] = node;
- }
- }
-
- if (nbPoints != params.size()) {
- MESSAGE( "BAD NODE ON EDGE POSITIONS" );
- return 0;
- }
- UVPtStruct* uvslf = new UVPtStruct[nbPoints + 2];
-
- double f, l;
- Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
-
- bool isForward = (((l - f) * (last - first)) > 0);
- double paramin = 0;
- double paramax = 0;
- if (isForward)
- {
- paramin = f;
- paramax = l;
- gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward
- uvslf[0].x = p.X();
- uvslf[0].y = p.Y();
- uvslf[0].param = f;
- uvslf[0].node = idFirst;
- //MESSAGE("__ f "<<f<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
- map < double, const SMDS_MeshNode* >::iterator itp = params.begin();
- for (int i = 1; i <= nbPoints; i++) // nbPoints internal
- {
- double param = (*itp).first;
- gp_Pnt2d p = C2d->Value(param);
- uvslf[i].x = p.X();
- uvslf[i].y = p.Y();
- uvslf[i].param = param;
- uvslf[i].node = (*itp).second;
- //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
- itp++;
- }
- p = C2d->Value(l); // last point = Vertex Reversed
- uvslf[nbPoints + 1].x = p.X();
- uvslf[nbPoints + 1].y = p.Y();
- uvslf[nbPoints + 1].param = l;
- uvslf[nbPoints + 1].node = idLast;
- //MESSAGE("__ l "<<l<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
- } else
- {
- paramin = l;
- paramax = f;
- gp_Pnt2d p = C2d->Value(l); // first point = Vertex Reversed
- uvslf[0].x = p.X();
- uvslf[0].y = p.Y();
- uvslf[0].param = l;
- uvslf[0].node = idLast;
- //MESSAGE("__ l "<<l<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
- map < double, const SMDS_MeshNode* >::reverse_iterator itp = params.rbegin();
-
- for (int j = nbPoints; j >= 1; j--) // nbPoints internal
- {
- double param = (*itp).first;
- int i = nbPoints + 1 - j;
- gp_Pnt2d p = C2d->Value(param);
- uvslf[i].x = p.X();
- uvslf[i].y = p.Y();
- uvslf[i].param = param;
- uvslf[i].node = (*itp).second;
- //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
- itp++;
- }
- p = C2d->Value(f); // last point = Vertex Forward
- uvslf[nbPoints + 1].x = p.X();
- uvslf[nbPoints + 1].y = p.Y();
- uvslf[nbPoints + 1].param = f;
- uvslf[nbPoints + 1].node = idFirst;
- //MESSAGE("__ f "<<f<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
- }
-
- ASSERT(paramin != paramax);
- for (int i = 0; i < nbPoints + 2; i++)
- {
- uvslf[i].normParam = (uvslf[i].param - paramin) / (paramax - paramin);
- }
-
- return uvslf;
-}
-
-//=============================================================================
-/*!
- * MakeEdgePoints
- */
-//=============================================================================
-UVPtStruct* StdMeshers_Quadrangle_2D::MakeEdgePoints (SMESH_Mesh & aMesh,
- const TopoDS_Face& F,
- const TopoDS_Edge& E,
- double first, double last,
- int nb_segm)
-{
-// MESSAGE("StdMeshers_Quadrangle_2D::MakeEdgePoints");
-
- UVPtStruct* uvslf = new UVPtStruct[nb_segm + 1];
- list<double> params;
-
- // --- edge internal points
- double fi, li;
- Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, fi, li);
- if (!Curve.IsNull()) {
- try {
- GeomAdaptor_Curve C3d (Curve);
- double length = EdgeLength(E);
- double eltSize = length / nb_segm;
- GCPnts_UniformAbscissa Discret (C3d, eltSize, fi, li);
- if (!Discret.IsDone()) return false;
- int NbPoints = Discret.NbPoints();
- for (int i = 1; i <= NbPoints; i++) {
- double param = Discret.Parameter(i);
- params.push_back(param);
+ else { // nr<nl
+ n2 = 1;
+ n1 = drl + 1;
+ TColgp_SequenceOfXY UVtmp;
+ double dlparam = npl.Value(nl) - npl.Value(nnn-1);
+ double drparam = npr.Value(nnn) - npr.Value(nnn-1);
+ double y0 = npl.Value(nnn-1);
+ double y1 = npr.Value(nnn-1);
+ for(i=1; i<=drl; i++) {
+ // add existed nodes from right edge
+ NodesC.SetValue(1,i+1,uv_el[nnn+i-2].node);
+ y0 = npl.Value(nnn+i-1); // param on left edge
+ double dpar = (y0 - npl.Value(nnn-1))/dlparam;
+ y1 = npr.Value(nnn-1) + dpar*drparam; // param on right edge
+ double dy = y1 - y0;
+ for(j=2; j<=nb; j++) {
+ double x = npb.Value(j)*npt.Value(nt-i);
+ double y = y0 + dy*x;
+ gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+ gp_Pnt P = S->Value(UV.X(),UV.Y());
+ SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
+ NodesC.SetValue(j,i+1,N);
+ }
+ }
+ double dy0 = (1-y0)/(addv+1);
+ double dy1 = (1-y1)/(addv+1);
+ for(i=1; i<=addv; i++) {
+ double yy0 = y0 + dy0*i;
+ double yy1 = y1 + dy1*i;
+ double dyy = yy1 - yy0;
+ for(j=1; j<=nb; j++) {
+ double x = npt.Value(i+1) +
+ npb.Value(j) * ( npt.Value(nt-i-drl) - npt.Value(i+1) );
+ double y = yy0 + dyy*x;
+ gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+ gp_Pnt P = S->Value(UV.X(),UV.Y());
+ SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
+ NodesC.SetValue(j,i+drl+1,N);
+ }
+ }