0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSu...
[occt.git] / src / GeomFill / GeomFill_SimpleBound.cxx
1 // Created on: 1995-11-03
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <Adaptor3d_Curve.hxx>
19 #include <GeomFill_SimpleBound.hxx>
20 #include <gp_Pnt.hxx>
21 #include <gp_Vec.hxx>
22 #include <Law.hxx>
23 #include <Law_BSpFunc.hxx>
24 #include <Law_Function.hxx>
25 #include <Standard_Type.hxx>
26
27 IMPLEMENT_STANDARD_RTTIEXT(GeomFill_SimpleBound,GeomFill_Boundary)
28
29 //=======================================================================
30 //function : GeomFill_SimpleBound
31 //purpose  : 
32 //=======================================================================
33 GeomFill_SimpleBound::GeomFill_SimpleBound
34 (const Handle(Adaptor3d_Curve)& Curve,
35  const Standard_Real           Tol3d,
36  const Standard_Real           Tolang) :
37  GeomFill_Boundary(Tol3d,Tolang), myC3d(Curve)
38 {
39 }
40
41 //=======================================================================
42 //function : Value
43 //purpose  : 
44 //=======================================================================
45
46 gp_Pnt GeomFill_SimpleBound::Value(const Standard_Real U) const 
47 {
48   Standard_Real x = U;
49   if(!myPar.IsNull()) x = myPar->Value(U);
50   return myC3d->Value(x);
51 }
52
53
54 //=======================================================================
55 //function : D1
56 //purpose  : 
57 //=======================================================================
58
59 void GeomFill_SimpleBound::D1(const Standard_Real U, 
60                               gp_Pnt& P, 
61                               gp_Vec& V) const 
62 {
63   Standard_Real x = U, dx = 1.;
64   if(!myPar.IsNull()) myPar->D1(U,x,dx);
65   myC3d->D1(x, P, V);
66   V.Multiply(dx);
67 }
68
69 //=======================================================================
70 //function : Reparametrize
71 //purpose  : 
72 //=======================================================================
73
74 void GeomFill_SimpleBound::Reparametrize(const Standard_Real First, 
75                                          const Standard_Real Last,
76                                          const Standard_Boolean HasDF, 
77                                          const Standard_Boolean HasDL, 
78                                          const Standard_Real DF, 
79                                          const Standard_Real DL,
80                                          const Standard_Boolean Rev)
81 {
82   Handle(Law_BSpline) curve = Law::Reparametrize(*myC3d,
83                                                  First,Last,
84                                                  HasDF,HasDL,DF,DL,
85                                                  Rev,30);
86   myPar = new Law_BSpFunc();
87   Handle(Law_BSpFunc)::DownCast (myPar)->SetCurve(curve);
88 }
89
90 //=======================================================================
91 //function : Bounds
92 //purpose  : 
93 //=======================================================================
94
95 void GeomFill_SimpleBound::Bounds(Standard_Real& First, 
96                                   Standard_Real& Last) const 
97 {
98   if(!myPar.IsNull()) myPar->Bounds(First,Last);
99   else {
100     First = myC3d->FirstParameter();
101     Last = myC3d->LastParameter();
102   }
103 }
104
105
106 //=======================================================================
107 //function : IsDegenerated
108 //purpose  : 
109 //=======================================================================
110
111 Standard_Boolean GeomFill_SimpleBound::IsDegenerated() const 
112 {
113   return Standard_False;
114 }