1 -- Created on: 1995-05-29
2 -- Created by: Xavier BENVENISTE
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class ApproxAFunction from AdvApprox
19 uses Array1OfInteger from TColStd,
21 HArray1OfInteger from TColStd,
22 Array1OfReal from TColStd,
23 Array1OfPnt2d from TColgp,
24 Array1OfPnt from TColgp,
25 HArray1OfReal from TColStd,
26 HArray1OfPnt2d from TColgp,
27 HArray1OfPnt from TColgp,
28 HArray2OfReal from TColStd,
29 HArray2OfPnt2d from TColgp,
30 HArray2OfPnt from TColgp,
34 EvaluatorFunction from AdvApprox,
35 Cutting from AdvApprox
39 OutOfRange from Standard,
40 ConstructionError from Standard
43 Create(Num1DSS : Integer ;
46 OneDTol : HArray1OfReal from TColStd ;
47 TwoDTol : HArray1OfReal from TColStd ;
48 ThreeDTol : HArray1OfReal from TColStd ;
51 Continuity : Shape from GeomAbs ;
54 Func : EvaluatorFunction from AdvApprox)
56 returns ApproxAFunction from AdvApprox
57 raises ConstructionError;
59 ---Purpose: Constructs approximator tool.
62 -- the Func should be valid reference to object of type
63 -- inherited from class EvaluatorFunction from Approx
64 -- with life time longer than that of the approximator tool;
66 -- the result should be formatted in the following way :
67 -- <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
68 -- R[0] .... R[Num1DSS]..... R[Dimension-1]
70 -- the order in which each Subspace appears should be consistent
71 -- with the tolerances given in the create function and the
72 -- results will be given in that order as well that is :
73 -- Curve2d(n) will correspond to the nth entry
74 -- described by Num2DSS, Curve(n) will correspond to
75 -- the nth entry described by Num3DSS
76 -- The same type of schema applies to the Poles1d, Poles2d and
80 Create(Num1DSS : Integer ;
83 OneDTol : HArray1OfReal from TColStd ;
84 TwoDTol : HArray1OfReal from TColStd ;
85 ThreeDTol : HArray1OfReal from TColStd ;
88 Continuity : Shape from GeomAbs ;
91 Func : EvaluatorFunction from AdvApprox;
92 CutTool : Cutting from AdvApprox)
94 ---Purpose: Approximation with user methode of cutting
96 returns ApproxAFunction from AdvApprox
97 raises ConstructionError;
103 CutTool : Cutting from AdvApprox)
106 Approximation(myclass;
107 TotalDimension : Integer;
108 TotalNumSS : Integer;
109 LocalDimension : Array1OfInteger;
112 Evaluator : in out EvaluatorFunction;
113 CutTool : Cutting from AdvApprox;
114 ContinuityOrder : Integer;
115 NumMaxCoeffs : Integer;
116 MaxSegments : Integer;
117 TolerancesArray : Array1OfReal;
118 code_precis : Integer;
119 NumCurves : in out Integer;
120 NumCoeffPerCurveArray : in out Array1OfInteger;
121 LocalCoefficientArray : in out Array1OfReal;
122 IntervalsArray : in out Array1OfReal;
123 ErrorMaxArray : in out Array1OfReal;
124 AverageErrorArray : in out Array1OfReal;
125 ErrorCode : in out Integer);
128 IsDone(me) returns Boolean
131 -- True if the approximation succeeded within the imposed
133 HasResult(me) returns Boolean
136 -- True if the approximation did come out with a result that
137 -- is not NECESSARELY within the required tolerance
141 ---Purpose: returns the poles from the algorithms as is
142 returns HArray2OfReal from TColStd ;
145 ---Purpose: returns the poles from the algorithms as is
147 returns HArray2OfPnt2d from TColgp ;
150 ---Purpose: -- returns the poles from the algorithms as is
152 returns HArray2OfPnt from TColgp ;
154 NbPoles(me) returns Integer
155 ---Purpose: as the name says
158 Poles1d (me; Index : Integer ;
159 P : in out Array1OfReal from TColStd)
160 ---Purpose: returns the poles at Index from the 1d subspace
164 Poles2d (me; Index : Integer ;
165 P : in out Array1OfPnt2d from TColgp)
166 ---Purpose: returns the poles at Index from the 2d subspace
169 Poles (me; Index : Integer ;
170 P : in out Array1OfPnt from TColgp)
172 ---Purpose: returns the poles at Index from the 3d subspace
175 Degree(me) returns Integer
179 NbKnots(me) returns Integer
182 NumSubSpaces(me; Dimension : Integer) returns Integer
187 returns HArray1OfReal from TColStd ;
191 returns HArray1OfInteger from TColStd ;
193 MaxError (me; Dimension : Integer)
194 ---Purpose: returns the error as is in the algorithms
195 returns HArray1OfReal from TColStd ;
197 AverageError(me; Dimension : Integer)
199 ---Purpose: returns the error as is in the algorithms
200 returns HArray1OfReal from TColStd ;
202 MaxError (me; Dimension : Integer ;
203 Index : Integer) returns Real
206 AverageError(me; Dimension : Integer;
207 Index : Integer) returns Real
211 Dump(me; o: in out OStream);
212 ---Purpose: diplay information on approximation.
217 myNumSubSpaces : Integer[3] ;
218 -- Number of subspaces [0] = number of 1 dimensional subspaces
219 -- [1] = number of 2 dimensional subspaces
220 -- [2] = number of 3 dimensional subspaces
222 my1DTolerances : HArray1OfReal from TColStd ;
223 my2DTolerances : HArray1OfReal from TColStd ;
224 my3DTolerances : HArray1OfReal from TColStd ;
226 -- -- self explanatory : one tolerance per subspace
228 -- first parameter for the approximation
230 -- last parameter for the approximation
231 myContinuity : Shape from GeomAbs ;
233 -- continuity requested for the approximation
235 -- The evaluator of the function to approximate
236 -- must provide the derivatives up to the requested
237 -- order otherwise this will NOT WORK
238 myMaxDegree : Integer ;
239 -- maximum degree for the approximation
241 -- Because of the unstable evaluation after degree 14
242 -- this is limited to 14
243 myMaxSegments : Integer ;
244 -- maximum of segment allowed
248 -- tells if the approximation succeeded within the requested
250 myHasResult : Boolean ;
251 -- tells if the approximation returned a result although
252 -- it might not be within the requested tolerance. In
253 -- that case myDone will be false
255 my1DPoles : HArray2OfReal from TColStd ;
256 -- 1D poles if myNumSubSpaces[0] > 0
257 my2DPoles : HArray2OfPnt2d from TColgp ;
258 -- 2D poles if myNumSubSpaces[1] > 0
259 my3DPoles : HArray2OfPnt from TColgp ;
260 -- 3D poles if myNumSubSpaces[2] > 0
261 myKnots : HArray1OfReal from TColStd ;
262 myMults : HArray1OfInteger from TColStd ;
265 myEvaluator : Address from Standard;
269 my1DMaxError : HArray1OfReal from TColStd ;
270 my1DAverageError : HArray1OfReal from TColStd ;
271 my2DMaxError : HArray1OfReal from TColStd ;
272 my2DAverageError : HArray1OfReal from TColStd ;
273 my3DMaxError : HArray1OfReal from TColStd ;
274 my3DAverageError : HArray1OfReal from TColStd ;
276 end ApproxAFunction ;