1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 // pmn -> modified 17/01/1996 : utilisation de Curve() et SetCurve()
17 #include <Law_BSpline.hxx>
19 #include <Standard_Type.hxx>
20 #include <TColStd_Array1OfInteger.hxx>
21 #include <TColStd_Array1OfReal.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(Law_S,Law_BSpFunc)
29 void Law_S::Set (const Standard_Real Pdeb,
30 const Standard_Real Valdeb,
31 const Standard_Real Pfin,
32 const Standard_Real Valfin)
34 Set(Pdeb,Valdeb,0.,Pfin,Valfin,0.);
38 void Law_S::Set (const Standard_Real Pdeb,
39 const Standard_Real Valdeb,
40 const Standard_Real Ddeb,
41 const Standard_Real Pfin,
42 const Standard_Real Valfin,
43 const Standard_Real Dfin)
45 TColStd_Array1OfReal poles(1,4);
46 TColStd_Array1OfReal knots(1,2);
47 TColStd_Array1OfInteger mults(1,2);
48 poles(1) = Valdeb; poles(4) = Valfin;
49 Standard_Real coe = (Pfin-Pdeb) / 3.;
50 poles(2) = Valdeb + coe * Ddeb;
51 poles(3) = Valfin - coe * Dfin;
52 knots(1) = Pdeb; knots(2) = Pfin;
53 mults(1) = mults(2) = 4;
55 SetCurve( new Law_BSpline(poles,knots,mults,3) );