0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSu...
[occt.git] / src / GeomInt / GeomInt_WLApprox.hxx
1 // Created on: 1995-01-27
2 // Created by: Jacques GOUSSARD
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 #ifndef _GeomInt_WLApprox_HeaderFile
18 #define _GeomInt_WLApprox_HeaderFile
19
20 #include <Adaptor3d_Surface.hxx>
21 #include <NCollection_Vector.hxx>
22 #include <GeomInt_TheComputeLineOfWLApprox.hxx>
23 #include <GeomInt_TheComputeLineBezierOfWLApprox.hxx>
24 #include <Approx_MCurvesToBSpCurve.hxx>
25 #include <Approx_ParametrizationType.hxx>
26
27 class Adaptor3d_HSurfaceTool;
28 class IntSurf_Quadric;
29 class IntSurf_QuadricTool;
30 class IntPatch_WLine;
31 class GeomInt_ThePrmPrmSvSurfacesOfWLApprox;
32 class GeomInt_TheInt2SOfThePrmPrmSvSurfacesOfWLApprox;
33 class GeomInt_TheImpPrmSvSurfacesOfWLApprox;
34 class GeomInt_TheZerImpFuncOfTheImpPrmSvSurfacesOfWLApprox;
35 class GeomInt_TheMultiLineOfWLApprox;
36 class GeomInt_TheMultiLineToolOfWLApprox;
37 class GeomInt_TheComputeLineOfWLApprox;
38 class GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox;
39 class GeomInt_MyGradientbisOfTheComputeLineOfWLApprox;
40 class GeomInt_TheComputeLineBezierOfWLApprox;
41 class GeomInt_MyGradientOfTheComputeLineBezierOfWLApprox;
42 class AppParCurves_MultiBSpCurve;
43
44 class GeomInt_WLApprox 
45 {
46 private:
47   struct Approx_Data 
48   {
49     Approx_Data () : myBezierApprox (Standard_True),
50       Xo (0.0), Yo (0.0), Zo (0.0),
51       U1o (0.0), V1o (0.0), U2o (0.0), V2o (0.0),
52       ApproxXYZ (Standard_True),
53       ApproxU1V1 (Standard_True),
54       ApproxU2V2 (Standard_True),
55       indicemin (0), indicemax (0),
56       myNbPntMax (30), parametrization (Approx_ChordLength)
57     {
58     }
59
60     Standard_Boolean myBezierApprox;
61     Standard_Real  Xo, Yo, Zo, U1o, V1o, U2o, V2o;
62     Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2;
63     Standard_Integer indicemin, indicemax, myNbPntMax;
64     Approx_ParametrizationType parametrization;
65   };
66
67 public:
68
69   DEFINE_STANDARD_ALLOC
70
71   
72   Standard_EXPORT GeomInt_WLApprox();
73   
74   Standard_EXPORT void Perform (const Handle(Adaptor3d_Surface)& Surf1, const Handle(Adaptor3d_Surface)& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
75   
76   Standard_EXPORT void Perform (const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
77   
78   Standard_EXPORT 
79       void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d,
80                           const Standard_Integer DegMin, 
81                           const Standard_Integer DegMax,
82                           const Standard_Integer NbIterMax,
83                           const Standard_Integer NbPntMax = 30,
84                           const Standard_Boolean ApproxWithTangency = Standard_True,
85                           const Approx_ParametrizationType
86                                           Parametrization = Approx_ChordLength);  
87   Standard_EXPORT void Perform();
88   
89   Standard_EXPORT Standard_Real TolReached3d() const;
90   
91   Standard_EXPORT Standard_Real TolReached2d() const;
92   
93   Standard_EXPORT Standard_Boolean IsDone() const;
94   
95   Standard_EXPORT Standard_Integer NbMultiCurves() const;
96   
97   Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const;
98
99
100
101
102 protected:
103
104
105
106
107
108 private:
109   Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const Handle(Adaptor3d_Surface)& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax, const Standard_Boolean isTheQuadFirst);
110   
111   Standard_EXPORT void UpdateTolReached();
112
113   //! Fill data structure for intersection approximation.
114   Standard_EXPORT void fillData(const Handle(IntPatch_WLine)& theLine);
115
116   //! Prepare data structure for further computations.
117   Standard_EXPORT void prepareDS(const Standard_Boolean theApproxXYZ,
118                                  const Standard_Boolean theApproxU1V1,
119                                  const Standard_Boolean theApproxU2V2,
120                                  const Standard_Integer indicemin,
121                                  const Standard_Integer indicemax);
122
123   //! Build knot sequence.
124   Standard_EXPORT void buildKnots(const Handle(IntPatch_WLine)& theline,
125                                   const Standard_Address thePtrSVSurf);
126
127   //! Build curve.
128   Standard_EXPORT void buildCurve(const Handle(IntPatch_WLine)& theline,
129                                   const Standard_Address thePtrSVSurf);
130
131   GeomInt_TheComputeLineOfWLApprox myComputeLine;
132   GeomInt_TheComputeLineBezierOfWLApprox myComputeLineBezier;
133   Approx_MCurvesToBSpCurve myBezToBSpl;
134   Standard_Boolean myWithTangency;
135   Standard_Real myTol3d;
136   Standard_Real myTol2d;
137   Standard_Integer myDegMin;
138   Standard_Integer myDegMax;
139   Standard_Integer myNbIterMax;
140   Standard_Real myTolReached3d;
141   Standard_Real myTolReached2d;
142   Approx_Data myData;
143   NCollection_Vector<Standard_Integer> myKnots;
144
145 };
146
147
148
149
150
151
152
153 #endif // _GeomInt_WLApprox_HeaderFile