// pmn -> modified 17/01/1996 : utilisation de Curve() et SetCurve() #include #include #include #include #include #include #ifdef DEB #ifdef DRAW // Pour le dessin. #include #include #include #include #include #include #include #include static void Law_draw1dcurve(const Handle(Law_BSpline)& bs, const gp_Vec2d& tra, const Standard_Real scal) { TColStd_Array1OfReal pol(1,bs->NbPoles()); bs->Poles(pol); TColStd_Array1OfReal knots(1,bs->NbKnots()); bs->Knots(knots); TColStd_Array1OfInteger mults(1,bs->NbKnots()); bs->Multiplicities(mults); Standard_Integer deg = bs->Degree(); Standard_Integer nbk = knots.Length(); Handle(Draw_Marker2D) mar; gp_Pnt2d pp(knots(1),scal*bs->Value(knots(1))); pp.Translate(tra); gp_Pnt2d qq; mar = new Draw_Marker2D(pp,Draw_Square,Draw_cyan); dout<Value(uu)); qq.Translate(tra); seg = new Draw_Segment2D(pp,qq,Draw_jaune); dout<SetValue(i,x); if(!Periodic || i != nbp) rad->SetValue(i,y); } Law_Interpolate inter(rad,par,Periodic,Precision::Confusion()); inter.Perform(); SetCurve(inter.Curve()); #ifdef DEB #ifdef DRAW if (Affich) { gp_Vec2d veve(0.,0.); Law_draw1dcurve(Curve(),veve,1.); } #endif #endif } //======================================================================= //function : SetInRelative //purpose : //======================================================================= void Law_Interpol::SetInRelative(const TColgp_Array1OfPnt2d& ParAndRad, const Standard_Real Ud, const Standard_Real Uf, const Standard_Boolean Periodic) { Standard_Integer l = ParAndRad.Lower(), u = ParAndRad.Upper(); Standard_Real wd = ParAndRad(l).X(),wf = ParAndRad(u).X(); Standard_Integer nbp = ParAndRad.Length(); Handle(TColStd_HArray1OfReal) par = new TColStd_HArray1OfReal(1,nbp); Handle(TColStd_HArray1OfReal) rad; if(Periodic) rad = new TColStd_HArray1OfReal(1,nbp - 1); else rad = new TColStd_HArray1OfReal(1,nbp); Standard_Real x,y; Standard_Integer i; for(i = 1; i <= nbp; i++){ ParAndRad(l + i - 1).Coord(x,y); par->SetValue(i,(Uf*(x-wd)+Ud*(wf-x))/(wf-wd)); if(!Periodic || i != nbp) rad->SetValue(i,y); } Law_Interpolate inter(rad,par,Periodic,Precision::Confusion()); inter.Perform(); SetCurve(inter.Curve()); #ifdef DEB #ifdef DRAW if (Affich) { gp_Vec2d veve(0.,0.); Law_draw1dcurve(Curve(),veve,1.); } #endif #endif } //======================================================================= //function : Set //purpose : //======================================================================= void Law_Interpol::Set(const TColgp_Array1OfPnt2d& ParAndRad, const Standard_Real Dd, const Standard_Real Df, const Standard_Boolean Periodic) { Standard_Integer l = ParAndRad.Lower(); Standard_Integer nbp = ParAndRad.Length(); Handle(TColStd_HArray1OfReal) par = new TColStd_HArray1OfReal(1,nbp); Handle(TColStd_HArray1OfReal) rad; if(Periodic) rad = new TColStd_HArray1OfReal(1,nbp - 1); else rad = new TColStd_HArray1OfReal(1,nbp); Standard_Real x,y; Standard_Integer i; for(i = 1; i <= nbp; i++){ ParAndRad(l + i - 1).Coord(x,y); par->SetValue(i,x); if(!Periodic || i != nbp) rad->SetValue(i,y); } Law_Interpolate inter(rad,par,Periodic,Precision::Confusion()); inter.Load(Dd,Df); inter.Perform(); SetCurve(inter.Curve()); } //======================================================================= //function : SetInRelative //purpose : //======================================================================= void Law_Interpol::SetInRelative(const TColgp_Array1OfPnt2d& ParAndRad, const Standard_Real Ud, const Standard_Real Uf, const Standard_Real Dd, const Standard_Real Df, const Standard_Boolean Periodic) { Standard_Integer l = ParAndRad.Lower(), u = ParAndRad.Upper(); Standard_Real wd = ParAndRad(l).X(),wf = ParAndRad(u).X(); Standard_Integer nbp = ParAndRad.Length(); Handle(TColStd_HArray1OfReal) par = new TColStd_HArray1OfReal(1,nbp); Handle(TColStd_HArray1OfReal) rad; if(Periodic) rad = new TColStd_HArray1OfReal(1,nbp - 1); else rad = new TColStd_HArray1OfReal(1,nbp); Standard_Real x,y; Standard_Integer i; for(i = 1; i <= nbp; i++){ ParAndRad(l + i - 1).Coord(x,y); par->SetValue(i,(Uf*(x-wd)+Ud*(wf-x))/(wf-wd)); if(!Periodic || i != nbp) rad->SetValue(i,y); } Law_Interpolate inter(rad,par,Periodic,Precision::Confusion()); inter.Load(Dd,Df); inter.Perform(); SetCurve(inter.Curve()); }