0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / AdvApp2Var / AdvApp2Var_ApproxAFunc2Var.hxx
1 // Created on: 1996-02-14
2 // Created by: Joelle CHAUVET
3 // Copyright (c) 1996-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 _AdvApp2Var_ApproxAFunc2Var_HeaderFile
18 #define _AdvApp2Var_ApproxAFunc2Var_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Integer.hxx>
25 #include <TColStd_HArray1OfReal.hxx>
26 #include <TColStd_HArray2OfReal.hxx>
27 #include <Standard_Real.hxx>
28 #include <GeomAbs_IsoType.hxx>
29 #include <GeomAbs_Shape.hxx>
30 #include <AdvApp2Var_Context.hxx>
31 #include <AdvApp2Var_Network.hxx>
32 #include <AdvApp2Var_Framework.hxx>
33 #include <Standard_Boolean.hxx>
34 #include <TColGeom_HArray1OfSurface.hxx>
35 #include <AdvApp2Var_EvaluatorFunc2Var.hxx>
36 #include <Standard_OStream.hxx>
37 class Standard_OutOfRange;
38 class Standard_ConstructionError;
39 class AdvApprox_Cutting;
40 class AdvApp2Var_Criterion;
41 class Geom_BSplineSurface;
42
43
44 //! Perform   the  approximation of  <Func>     F(U,V)
45 //! Arguments are :
46 //! Num1DSS, Num2DSS, Num3DSS :The numbers of 1,2,3 dimensional subspaces
47 //! OneDTol, TwoDTol, ThreeDTol: The tolerance of approximation in each
48 //! subspaces
49 //! OneDTolFr, TwoDTolFr, ThreeDTolFr: The tolerance of approximation on
50 //! the boundarys in each subspaces
51 //! [FirstInU, LastInU]: The Bounds in U of the Approximation
52 //! [FirstInV, LastInV]: The Bounds in V of the Approximation
53 //! FavorIso : Give preference to extract u-iso or v-iso on F(U,V)
54 //! This can be usefull to optimize the <Func> methode
55 //! ContInU, ContInV : Continuity waiting in u and v
56 //! PrecisCode : Precision on approximation's error mesurement
57 //! 1 : Fast computation and average precision
58 //! 2 : Average computation and good precision
59 //! 3 : Slow computation and very good precision
60 //! MaxDegInU : Maximum u-degree waiting in U
61 //! MaxDegInV : Maximum u-degree waiting in V
62 //! Warning:
63 //! MaxDegInU (resp. MaxDegInV) must be >= 2*iu (resp. iv) + 1,
64 //! where iu (resp. iv) = 0 if ContInU (resp. ContInV)  = GeomAbs_C0,
65 //! = 1 if                          = GeomAbs_C1,
66 //! = 2 if                          = GeomAbs_C2.
67 //! MaxPatch  : Maximun number of Patch waiting
68 //! number of Patch is number of u span * number of v span
69 //! Func      : The external method to evaluate F(U,V)
70 //! Crit      : To (re)defined condition of convergence
71 //! UChoice, VChoice : To define the way in U (or V) Knot insertion
72 //! Warning:
73 //! for the moment, the result is a 3D Surface
74 //! so Num1DSS and Num2DSS must be equals to 0
75 //! and Num3DSS must be equal to 1.
76 //! Warning:
77 //! the Function of type EvaluatorFunc2Var from Approx
78 //! must be a subclass of AdvApp2Var_EvaluatorFunc2Var
79 //!
80 //! the result should be formatted in the following way :
81 //! <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
82 //! R[0,0] ....   R[Num1DSS,0].....  R[Dimension-1,0] for the 1st parameter
83 //! R[0,i] ....   R[Num1DSS,i].....  R[Dimension-1,i] for the ith parameter
84 //! R[0,N-1] .... R[Num1DSS,N-1].... R[Dimension-1,N-1] for the Nth parameter
85 //!
86 //! the order in which each Subspace appears should be consistent
87 //! with the tolerances given in the create function and the
88 //! results will be given in that order as well that is :
89 //! Surface(n) will correspond to the nth entry described by Num3DSS
90 class AdvApp2Var_ApproxAFunc2Var 
91 {
92 public:
93
94   DEFINE_STANDARD_ALLOC
95
96   
97   Standard_EXPORT AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS, const Standard_Integer Num2DSS, const Standard_Integer Num3DSS, const Handle(TColStd_HArray1OfReal)& OneDTol, const Handle(TColStd_HArray1OfReal)& TwoDTol, const Handle(TColStd_HArray1OfReal)& ThreeDTol, const Handle(TColStd_HArray2OfReal)& OneDTolFr, const Handle(TColStd_HArray2OfReal)& TwoDTolFr, const Handle(TColStd_HArray2OfReal)& ThreeDTolFr, const Standard_Real FirstInU, const Standard_Real LastInU, const Standard_Real FirstInV, const Standard_Real LastInV, const GeomAbs_IsoType FavorIso, const GeomAbs_Shape ContInU, const GeomAbs_Shape ContInV, const Standard_Integer PrecisCode, const Standard_Integer MaxDegInU, const Standard_Integer MaxDegInV, const Standard_Integer MaxPatch, const AdvApp2Var_EvaluatorFunc2Var& Func, AdvApprox_Cutting& UChoice, AdvApprox_Cutting& VChoice);
98   
99   Standard_EXPORT AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS, const Standard_Integer Num2DSS, const Standard_Integer Num3DSS, const Handle(TColStd_HArray1OfReal)& OneDTol, const Handle(TColStd_HArray1OfReal)& TwoDTol, const Handle(TColStd_HArray1OfReal)& ThreeDTol, const Handle(TColStd_HArray2OfReal)& OneDTolFr, const Handle(TColStd_HArray2OfReal)& TwoDTolFr, const Handle(TColStd_HArray2OfReal)& ThreeDTolFr, const Standard_Real FirstInU, const Standard_Real LastInU, const Standard_Real FirstInV, const Standard_Real LastInV, const GeomAbs_IsoType FavorIso, const GeomAbs_Shape ContInU, const GeomAbs_Shape ContInV, const Standard_Integer PrecisCode, const Standard_Integer MaxDegInU, const Standard_Integer MaxDegInV, const Standard_Integer MaxPatch, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit, AdvApprox_Cutting& UChoice, AdvApprox_Cutting& VChoice);
100   
101   //! True if the approximation succeeded within the imposed
102   //! tolerances and the wished continuities
103     Standard_Boolean IsDone() const;
104   
105   //! True if the approximation did come out with a result that
106   //! is not NECESSARELY within the required tolerance or a result
107   //! that is not recognized with the wished continuities
108     Standard_Boolean HasResult() const;
109   
110   //! returns the BSplineSurface of range Index
111     Handle(Geom_BSplineSurface) Surface (const Standard_Integer Index) const;
112   
113     Standard_Integer UDegree() const;
114   
115     Standard_Integer VDegree() const;
116   
117     Standard_Integer NumSubSpaces (const Standard_Integer Dimension) const;
118   
119   //! returns the errors max
120   Standard_EXPORT Handle(TColStd_HArray1OfReal) MaxError (const Standard_Integer Dimension) const;
121   
122   //! returns the average errors
123   Standard_EXPORT Handle(TColStd_HArray1OfReal) AverageError (const Standard_Integer Dimension) const;
124   
125   //! returns the errors max on UFrontiers
126   //! Warning:
127   //! Dimension must be equal to 3.
128   Standard_EXPORT Handle(TColStd_HArray1OfReal) UFrontError (const Standard_Integer Dimension) const;
129   
130   //! returns the errors max on VFrontiers
131   //! Warning:
132   //! Dimension must be equal to 3.
133   Standard_EXPORT Handle(TColStd_HArray1OfReal) VFrontError (const Standard_Integer Dimension) const;
134   
135   //! returns the error max of the BSplineSurface of range Index
136   Standard_EXPORT Standard_Real MaxError (const Standard_Integer Dimension, const Standard_Integer Index) const;
137   
138   //! returns the average error of the BSplineSurface of range Index
139   Standard_EXPORT Standard_Real AverageError (const Standard_Integer Dimension, const Standard_Integer Index) const;
140   
141   //! returns the error max of the BSplineSurface of range Index on a UFrontier
142   Standard_EXPORT Standard_Real UFrontError (const Standard_Integer Dimension, const Standard_Integer Index) const;
143   
144   //! returns the error max of the BSplineSurface of range Index on a VFrontier
145   Standard_EXPORT Standard_Real VFrontError (const Standard_Integer Dimension, const Standard_Integer Index) const;
146   
147   Standard_EXPORT Standard_Real CritError (const Standard_Integer Dimension, const Standard_Integer Index) const;
148   
149   //! Prints on the stream o informations on the current state
150   //! of the object.
151   Standard_EXPORT void Dump (Standard_OStream& o) const;
152
153
154
155
156 protected:
157
158
159
160
161
162 private:
163
164   
165   //! Initialisation of the approximation ; used by Create
166   Standard_EXPORT void Init();
167   
168   //! Initialisation of the approximation with a grid of regular cuttings ;
169   //! used by Init and Perform
170   Standard_EXPORT void InitGrid (const Standard_Integer NbInt);
171   
172   //! Computation of the approximation result ; used by Create
173   Standard_EXPORT void Perform (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func);
174   
175   //! Computation of the approximation result ; used by Create
176   Standard_EXPORT void Perform (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit);
177   
178   //! Computation of the polynomial approximations ; used by Perform
179   Standard_EXPORT void ComputePatches (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func);
180   
181   //! Computation of the polynomial approximations ; used by Perform
182   Standard_EXPORT void ComputePatches (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit);
183   
184   //! Approximation of the constraints ; used by ComputePatches
185   Standard_EXPORT void ComputeConstraints (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func);
186   
187   //! Approximation of the constraints ; used by ComputePatches
188   Standard_EXPORT void ComputeConstraints (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit);
189   
190   //! Computation of the 3D errors on the approximation result ; used by Perform
191   Standard_EXPORT void Compute3DErrors();
192   
193   //! Computation of the max value of the criterion on the approximation result ;
194   //! used by Perform
195   Standard_EXPORT void ComputeCritError();
196   
197   //! Conversion of the approximation result in BSpline; used by Create
198   Standard_EXPORT void ConvertBS();
199
200
201   Standard_Integer myNumSubSpaces[3];
202   Handle(TColStd_HArray1OfReal) my1DTolerances;
203   Handle(TColStd_HArray1OfReal) my2DTolerances;
204   Handle(TColStd_HArray1OfReal) my3DTolerances;
205   Handle(TColStd_HArray2OfReal) my1DTolOnFront;
206   Handle(TColStd_HArray2OfReal) my2DTolOnFront;
207   Handle(TColStd_HArray2OfReal) my3DTolOnFront;
208   Standard_Real myFirstParInU;
209   Standard_Real myLastParInU;
210   Standard_Real myFirstParInV;
211   Standard_Real myLastParInV;
212   GeomAbs_IsoType myFavoriteIso;
213   GeomAbs_Shape myContInU;
214   GeomAbs_Shape myContInV;
215   Standard_Integer myPrecisionCode;
216   Standard_Integer myMaxDegInU;
217   Standard_Integer myMaxDegInV;
218   Standard_Integer myMaxPatches;
219   AdvApp2Var_Context myConditions;
220   AdvApp2Var_Network myResult;
221   AdvApp2Var_Framework myConstraints;
222   Standard_Boolean myDone;
223   Standard_Boolean myHasResult;
224   Handle(TColGeom_HArray1OfSurface) mySurfaces;
225   Standard_Integer myDegreeInU;
226   Standard_Integer myDegreeInV;
227   Handle(TColStd_HArray1OfReal) my1DMaxError;
228   Handle(TColStd_HArray1OfReal) my1DAverageError;
229   Handle(TColStd_HArray1OfReal) my1DUFrontError;
230   Handle(TColStd_HArray1OfReal) my1DVFrontError;
231   Handle(TColStd_HArray1OfReal) my2DMaxError;
232   Handle(TColStd_HArray1OfReal) my2DAverageError;
233   Handle(TColStd_HArray1OfReal) my2DUFrontError;
234   Handle(TColStd_HArray1OfReal) my2DVFrontError;
235   Handle(TColStd_HArray1OfReal) my3DMaxError;
236   Handle(TColStd_HArray1OfReal) my3DAverageError;
237   Handle(TColStd_HArray1OfReal) my3DUFrontError;
238   Handle(TColStd_HArray1OfReal) my3DVFrontError;
239   Standard_Real myCriterionError;
240
241
242 };
243
244
245 #include <AdvApp2Var_ApproxAFunc2Var.lxx>
246
247
248
249
250
251 #endif // _AdvApp2Var_ApproxAFunc2Var_HeaderFile