0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / Law / Law_S.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15// pmn -> modified 17/01/1996 : utilisation de Curve() et SetCurve()
16
7fd59977 17#include <Law_BSpline.hxx>
42cf5bc1 18#include <Law_S.hxx>
19#include <Standard_Type.hxx>
20#include <TColStd_Array1OfInteger.hxx>
21#include <TColStd_Array1OfReal.hxx>
7fd59977 22
92efcf78 23IMPLEMENT_STANDARD_RTTIEXT(Law_S,Law_BSpFunc)
24
7fd59977 25Law_S::Law_S ()
26{}
27
28
29void Law_S::Set (const Standard_Real Pdeb,
30 const Standard_Real Valdeb,
31 const Standard_Real Pfin,
32 const Standard_Real Valfin)
33{
34 Set(Pdeb,Valdeb,0.,Pfin,Valfin,0.);
35}
36
37
38void 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)
44{
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;
54
55 SetCurve( new Law_BSpline(poles,knots,mults,3) );
56}