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 -- this approximate a given function
20 uses Array1OfInteger from TColStd,
22 HArray1OfInteger from TColStd,
23 Array1OfReal from TColStd,
24 Array1OfPnt2d from TColgp,
25 Array1OfPnt from TColgp,
26 HArray1OfReal from TColStd,
27 HArray1OfPnt2d from TColgp,
28 HArray1OfPnt from TColgp,
29 HArray2OfReal from TColStd,
30 HArray2OfPnt2d from TColgp,
31 HArray2OfPnt from TColgp,
35 EvaluatorFunction from AdvApprox,
36 Cutting from AdvApprox
40 OutOfRange from Standard,
41 ConstructionError from Standard
44 Create(Num1DSS : Integer ;
47 OneDTol : HArray1OfReal from TColStd ;
48 TwoDTol : HArray1OfReal from TColStd ;
49 ThreeDTol : HArray1OfReal from TColStd ;
52 Continuity : Shape from GeomAbs ;
55 Func : EvaluatorFunction from AdvApprox)
57 returns ApproxAFunction from AdvApprox
58 raises ConstructionError;
60 ---Purpose: Constructs approximator tool.
63 -- the Func should be valid reference to object of type
64 -- inherited from class EvaluatorFunction from Approx
65 -- with life time longer than that of the approximator tool;
67 -- the result should be formatted in the following way :
68 -- <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
69 -- R[0] .... R[Num1DSS]..... R[Dimension-1]
71 -- the order in which each Subspace appears should be consistent
72 -- with the tolerances given in the create function and the
73 -- results will be given in that order as well that is :
74 -- Curve2d(n) will correspond to the nth entry
75 -- described by Num2DSS, Curve(n) will correspond to
76 -- the nth entry described by Num3DSS
77 -- The same type of schema applies to the Poles1d, Poles2d and
81 Create(Num1DSS : Integer ;
84 OneDTol : HArray1OfReal from TColStd ;
85 TwoDTol : HArray1OfReal from TColStd ;
86 ThreeDTol : HArray1OfReal from TColStd ;
89 Continuity : Shape from GeomAbs ;
92 Func : EvaluatorFunction from AdvApprox;
93 CutTool : Cutting from AdvApprox)
95 ---Purpose: Approximation with user methode of cutting
97 returns ApproxAFunction from AdvApprox
98 raises ConstructionError;
104 CutTool : Cutting from AdvApprox)
107 Approximation(myclass;
108 TotalDimension : Integer;
109 TotalNumSS : Integer;
110 LocalDimension : Array1OfInteger;
113 Evaluator : in out EvaluatorFunction;
114 CutTool : Cutting from AdvApprox;
115 ContinuityOrder : Integer;
116 NumMaxCoeffs : Integer;
117 MaxSegments : Integer;
118 TolerancesArray : Array1OfReal;
119 code_precis : Integer;
120 NumCurves : in out Integer;
121 NumCoeffPerCurveArray : in out Array1OfInteger;
122 LocalCoefficientArray : in out Array1OfReal;
123 IntervalsArray : in out Array1OfReal;
124 ErrorMaxArray : in out Array1OfReal;
125 AverageErrorArray : in out Array1OfReal;
126 ErrorCode : in out Integer);
129 IsDone(me) returns Boolean
132 -- True if the approximation succeeded within the imposed
134 HasResult(me) returns Boolean
137 -- True if the approximation did come out with a result that
138 -- is not NECESSARELY within the required tolerance
142 ---Purpose: returns the poles from the algorithms as is
143 returns HArray2OfReal from TColStd ;
146 ---Purpose: returns the poles from the algorithms as is
148 returns HArray2OfPnt2d from TColgp ;
151 ---Purpose: -- returns the poles from the algorithms as is
153 returns HArray2OfPnt from TColgp ;
155 NbPoles(me) returns Integer
156 ---Purpose: as the name says
159 Poles1d (me; Index : Integer ;
160 P : in out Array1OfReal from TColStd)
161 ---Purpose: returns the poles at Index from the 1d subspace
165 Poles2d (me; Index : Integer ;
166 P : in out Array1OfPnt2d from TColgp)
167 ---Purpose: returns the poles at Index from the 2d subspace
170 Poles (me; Index : Integer ;
171 P : in out Array1OfPnt from TColgp)
173 ---Purpose: returns the poles at Index from the 3d subspace
176 Degree(me) returns Integer
180 NbKnots(me) returns Integer
183 NumSubSpaces(me; Dimension : Integer) returns Integer
188 returns HArray1OfReal from TColStd ;
192 returns HArray1OfInteger from TColStd ;
194 MaxError (me; Dimension : Integer)
195 ---Purpose: returns the error as is in the algorithms
196 returns HArray1OfReal from TColStd ;
198 AverageError(me; Dimension : Integer)
200 ---Purpose: returns the error as is in the algorithms
201 returns HArray1OfReal from TColStd ;
203 MaxError (me; Dimension : Integer ;
204 Index : Integer) returns Real
207 AverageError(me; Dimension : Integer;
208 Index : Integer) returns Real
212 Dump(me; o: in out OStream);
213 ---Purpose: diplay information on approximation.
218 myNumSubSpaces : Integer[3] ;
219 -- Number of subspaces [0] = number of 1 dimensional subspaces
220 -- [1] = number of 2 dimensional subspaces
221 -- [2] = number of 3 dimensional subspaces
223 my1DTolerances : HArray1OfReal from TColStd ;
224 my2DTolerances : HArray1OfReal from TColStd ;
225 my3DTolerances : HArray1OfReal from TColStd ;
227 -- -- self explanatory : one tolerance per subspace
229 -- first parameter for the approximation
231 -- last parameter for the approximation
232 myContinuity : Shape from GeomAbs ;
234 -- continuity requested for the approximation
236 -- The evaluator of the function to approximate
237 -- must provide the derivatives up to the requested
238 -- order otherwise this will NOT WORK
239 myMaxDegree : Integer ;
240 -- maximum degree for the approximation
242 -- Because of the unstable evaluation after degree 14
243 -- this is limited to 14
244 myMaxSegments : Integer ;
245 -- maximum of segment allowed
249 -- tells if the approximation succeeded within the requested
251 myHasResult : Boolean ;
252 -- tells if the approximation returned a result although
253 -- it might not be within the requested tolerance. In
254 -- that case myDone will be false
256 my1DPoles : HArray2OfReal from TColStd ;
257 -- 1D poles if myNumSubSpaces[0] > 0
258 my2DPoles : HArray2OfPnt2d from TColgp ;
259 -- 2D poles if myNumSubSpaces[1] > 0
260 my3DPoles : HArray2OfPnt from TColgp ;
261 -- 3D poles if myNumSubSpaces[2] > 0
262 myKnots : HArray1OfReal from TColStd ;
263 myMults : HArray1OfInteger from TColStd ;
266 myEvaluator : Address from Standard;
270 my1DMaxError : HArray1OfReal from TColStd ;
271 my1DAverageError : HArray1OfReal from TColStd ;
272 my2DMaxError : HArray1OfReal from TColStd ;
273 my2DAverageError : HArray1OfReal from TColStd ;
274 my3DMaxError : HArray1OfReal from TColStd ;
275 my3DAverageError : HArray1OfReal from TColStd ;
277 end ApproxAFunction ;