1 -- Created on: 1995-05-29
2 -- Created by: Xavier BENVENISTE
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
22 class ApproxAFunction from AdvApprox
24 uses Array1OfInteger from TColStd,
26 HArray1OfInteger from TColStd,
27 Array1OfReal from TColStd,
28 Array1OfPnt2d from TColgp,
29 Array1OfPnt from TColgp,
30 HArray1OfReal from TColStd,
31 HArray1OfPnt2d from TColgp,
32 HArray1OfPnt from TColgp,
33 HArray2OfReal from TColStd,
34 HArray2OfPnt2d from TColgp,
35 HArray2OfPnt from TColgp,
39 EvaluatorFunction from AdvApprox,
40 Cutting from AdvApprox
44 OutOfRange from Standard,
45 ConstructionError from Standard
48 Create(Num1DSS : Integer ;
51 OneDTol : HArray1OfReal from TColStd ;
52 TwoDTol : HArray1OfReal from TColStd ;
53 ThreeDTol : HArray1OfReal from TColStd ;
56 Continuity : Shape from GeomAbs ;
59 Func : EvaluatorFunction from AdvApprox)
61 returns ApproxAFunction from AdvApprox
62 raises ConstructionError;
64 ---Purpose: Constructs approximator tool.
67 -- the Func should be valid reference to object of type
68 -- inherited from class EvaluatorFunction from Approx
69 -- with life time longer than that of the approximator tool;
71 -- the result should be formatted in the following way :
72 -- <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
73 -- R[0] .... R[Num1DSS]..... R[Dimension-1]
75 -- the order in which each Subspace appears should be consistent
76 -- with the tolerances given in the create function and the
77 -- results will be given in that order as well that is :
78 -- Curve2d(n) will correspond to the nth entry
79 -- described by Num2DSS, Curve(n) will correspond to
80 -- the nth entry described by Num3DSS
81 -- The same type of schema applies to the Poles1d, Poles2d and
85 Create(Num1DSS : Integer ;
88 OneDTol : HArray1OfReal from TColStd ;
89 TwoDTol : HArray1OfReal from TColStd ;
90 ThreeDTol : HArray1OfReal from TColStd ;
93 Continuity : Shape from GeomAbs ;
96 Func : EvaluatorFunction from AdvApprox;
97 CutTool : Cutting from AdvApprox)
99 ---Purpose: Approximation with user methode of cutting
101 returns ApproxAFunction from AdvApprox
102 raises ConstructionError;
108 CutTool : Cutting from AdvApprox)
111 Approximation(myclass;
112 TotalDimension : Integer;
113 TotalNumSS : Integer;
114 LocalDimension : Array1OfInteger;
117 Evaluator : in out EvaluatorFunction;
118 CutTool : Cutting from AdvApprox;
119 ContinuityOrder : Integer;
120 NumMaxCoeffs : Integer;
121 MaxSegments : Integer;
122 TolerancesArray : Array1OfReal;
123 code_precis : Integer;
124 NumCurves : in out Integer;
125 NumCoeffPerCurveArray : in out Array1OfInteger;
126 LocalCoefficientArray : in out Array1OfReal;
127 IntervalsArray : in out Array1OfReal;
128 ErrorMaxArray : in out Array1OfReal;
129 AverageErrorArray : in out Array1OfReal;
130 ErrorCode : in out Integer);
133 IsDone(me) returns Boolean
136 -- True if the approximation succeeded within the imposed
138 HasResult(me) returns Boolean
141 -- True if the approximation did come out with a result that
142 -- is not NECESSARELY within the required tolerance
146 ---Purpose: returns the poles from the algorithms as is
147 returns HArray2OfReal from TColStd ;
150 ---Purpose: returns the poles from the algorithms as is
152 returns HArray2OfPnt2d from TColgp ;
155 ---Purpose: -- returns the poles from the algorithms as is
157 returns HArray2OfPnt from TColgp ;
159 NbPoles(me) returns Integer
160 ---Purpose: as the name says
163 Poles1d (me; Index : Integer ;
164 P : in out Array1OfReal from TColStd)
165 ---Purpose: returns the poles at Index from the 1d subspace
169 Poles2d (me; Index : Integer ;
170 P : in out Array1OfPnt2d from TColgp)
171 ---Purpose: returns the poles at Index from the 2d subspace
174 Poles (me; Index : Integer ;
175 P : in out Array1OfPnt from TColgp)
177 ---Purpose: returns the poles at Index from the 3d subspace
180 Degree(me) returns Integer
184 NbKnots(me) returns Integer
187 NumSubSpaces(me; Dimension : Integer) returns Integer
192 returns HArray1OfReal from TColStd ;
196 returns HArray1OfInteger from TColStd ;
198 MaxError (me; Dimension : Integer)
199 ---Purpose: returns the error as is in the algorithms
200 returns HArray1OfReal from TColStd ;
202 AverageError(me; Dimension : Integer)
204 ---Purpose: returns the error as is in the algorithms
205 returns HArray1OfReal from TColStd ;
207 MaxError (me; Dimension : Integer ;
208 Index : Integer) returns Real
211 AverageError(me; Dimension : Integer;
212 Index : Integer) returns Real
216 Dump(me; o: in out OStream);
217 ---Purpose: diplay information on approximation.
222 myNumSubSpaces : Integer[3] ;
223 -- Number of subspaces [0] = number of 1 dimensional subspaces
224 -- [1] = number of 2 dimensional subspaces
225 -- [2] = number of 3 dimensional subspaces
227 my1DTolerances : HArray1OfReal from TColStd ;
228 my2DTolerances : HArray1OfReal from TColStd ;
229 my3DTolerances : HArray1OfReal from TColStd ;
231 -- -- self explanatory : one tolerance per subspace
233 -- first parameter for the approximation
235 -- last parameter for the approximation
236 myContinuity : Shape from GeomAbs ;
238 -- continuity requested for the approximation
240 -- The evaluator of the function to approximate
241 -- must provide the derivatives up to the requested
242 -- order otherwise this will NOT WORK
243 myMaxDegree : Integer ;
244 -- maximum degree for the approximation
246 -- Because of the unstable evaluation after degree 14
247 -- this is limited to 14
248 myMaxSegments : Integer ;
249 -- maximum of segment allowed
253 -- tells if the approximation succeeded within the requested
255 myHasResult : Boolean ;
256 -- tells if the approximation returned a result although
257 -- it might not be within the requested tolerance. In
258 -- that case myDone will be false
260 my1DPoles : HArray2OfReal from TColStd ;
261 -- 1D poles if myNumSubSpaces[0] > 0
262 my2DPoles : HArray2OfPnt2d from TColgp ;
263 -- 2D poles if myNumSubSpaces[1] > 0
264 my3DPoles : HArray2OfPnt from TColgp ;
265 -- 3D poles if myNumSubSpaces[2] > 0
266 myKnots : HArray1OfReal from TColStd ;
267 myMults : HArray1OfInteger from TColStd ;
270 myEvaluator : Address from Standard;
274 my1DMaxError : HArray1OfReal from TColStd ;
275 my1DAverageError : HArray1OfReal from TColStd ;
276 my2DMaxError : HArray1OfReal from TColStd ;
277 my2DAverageError : HArray1OfReal from TColStd ;
278 my3DMaxError : HArray1OfReal from TColStd ;
279 my3DAverageError : HArray1OfReal from TColStd ;
281 end ApproxAFunction ;