b311480e |
1 | -- Created on: 1997-06-25 |
2 | -- Created by: Philippe MANGIN |
3 | -- Copyright (c) 1997-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
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. |
10 | -- |
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. |
13 | -- |
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. |
20 | |
7fd59977 |
21 | |
22 | |
23 | deferred class SweepFunction from Approx inherits TShared from MMgt |
24 | |
25 | ---Purpose: defined the function used by SweepApproximation to |
26 | -- perform sweeping application. |
27 | |
28 | |
29 | uses |
30 | Shape from GeomAbs, |
31 | Pnt from gp, |
32 | Array1OfPnt from TColgp, |
33 | Array1OfPnt2d from TColgp, |
34 | Array1OfVec from TColgp, |
35 | Array1OfVec2d from TColgp, |
36 | Array1OfInteger from TColStd, |
37 | Array1OfReal from TColStd |
38 | |
39 | raises NotImplemented , |
40 | OutOfRange from Standard |
41 | |
42 | is |
43 | |
44 | -- |
45 | --========== To compute Sections and derivatives Sections |
46 | -- |
47 | D0(me : mutable; |
48 | Param: Real; |
49 | First, Last : Real; |
50 | Poles : out Array1OfPnt from TColgp; |
51 | Poles2d : out Array1OfPnt2d from TColgp; |
52 | Weigths : out Array1OfReal from TColStd) |
53 | ---Purpose: compute the section for v = param |
54 | returns Boolean is deferred; |
55 | |
56 | D1(me : mutable; |
57 | Param: Real; |
58 | First, Last : Real; |
59 | Poles : out Array1OfPnt from TColgp; |
60 | DPoles : out Array1OfVec from TColgp; |
61 | Poles2d : out Array1OfPnt2d from TColgp; |
62 | DPoles2d : out Array1OfVec2d from TColgp; |
63 | Weigths : out Array1OfReal from TColStd; |
64 | DWeigths : out Array1OfReal from TColStd) |
65 | ---Purpose: compute the first derivative in v direction of the |
66 | -- section for v = param |
67 | -- Warning : It used only for C1 or C2 aproximation |
68 | returns Boolean |
69 | raises NotImplemented |
70 | is virtual; |
71 | |
72 | D2(me : mutable; |
73 | Param: Real; |
74 | First, Last : Real; |
75 | Poles : out Array1OfPnt from TColgp; |
76 | DPoles : out Array1OfVec from TColgp; |
77 | D2Poles : out Array1OfVec from TColgp; |
78 | Poles2d : out Array1OfPnt2d from TColgp; |
79 | DPoles2d : out Array1OfVec2d from TColgp; |
80 | D2Poles2d : out Array1OfVec2d from TColgp; |
81 | Weigths : out Array1OfReal from TColStd; |
82 | DWeigths : out Array1OfReal from TColStd; |
83 | D2Weigths : out Array1OfReal from TColStd) |
84 | ---Purpose: compute the second derivative in v direction of the |
85 | -- section for v = param |
86 | -- Warning : It used only for C2 aproximation |
87 | returns Boolean |
88 | raises NotImplemented |
89 | is virtual; |
90 | |
91 | -- |
92 | -- =================== General Information On The Function =================== |
93 | -- |
94 | Nb2dCurves(me) |
95 | ---Purpose: get the number of 2d curves to approximate. |
96 | returns Integer is deferred; |
97 | |
98 | SectionShape(me; NbPoles : out Integer from Standard; |
99 | NbKnots : out Integer from Standard; |
100 | Degree : out Integer from Standard) |
101 | ---Purpose: get the format of an section |
102 | is deferred; |
103 | |
104 | Knots(me; TKnots: out Array1OfReal from TColStd) |
105 | ---Purpose: get the Knots of the section |
106 | is deferred; |
107 | |
108 | Mults(me; TMults: out Array1OfInteger from TColStd) |
109 | ---Purpose: get the Multplicities of the section |
110 | is deferred; |
111 | |
112 | IsRational(me) |
113 | ---Purpose: Returns if the sections are rationnal or not |
114 | returns Boolean is deferred; |
115 | |
116 | |
117 | -- |
118 | -- =================== Management of continuity =================== |
119 | -- |
120 | NbIntervals(me; S : Shape from GeomAbs) |
121 | ---Purpose: Returns the number of intervals for continuity |
122 | -- <S>. |
123 | -- May be one if Continuity(me) >= <S> |
124 | returns Integer is deferred; |
125 | |
126 | Intervals(me; T : in out Array1OfReal from TColStd; |
127 | S : Shape from GeomAbs) |
128 | ---Purpose: Stores in <T> the parameters bounding the intervals |
129 | -- of continuity <S>. |
130 | -- |
131 | -- The array must provide enough room to accomodate |
132 | -- for the parameters. i.e. T.Length() > NbIntervals() |
133 | raises |
134 | OutOfRange from Standard |
135 | is deferred; |
136 | |
137 | |
138 | SetInterval(me: mutable; First, Last: Real from Standard) |
139 | ---Purpose: Sets the bounds of the parametric interval on |
140 | -- the fonction |
141 | -- This determines the derivatives in these values if the |
142 | -- function is not Cn. |
143 | is deferred; |
144 | |
145 | |
146 | -- ===================== To help computation of Tolerance ====== |
147 | -- Evaluation of error, in 2d space, or on rational function, is |
148 | -- difficult. The following methods can help the approximation to |
149 | -- make good evaluation and use good tolerances. |
150 | -- |
151 | -- It is not necessary for the following informations to be very |
152 | -- precise. A fast evaluation is sufficient. |
153 | |
154 | Resolution(me; |
155 | Index : Integer from Standard; |
156 | Tol : Real from Standard; |
157 | TolU, TolV : out Real from Standard) |
158 | ---Purpose: Returns the resolutions in the sub-space 2d <Index> |
159 | -- This information is usfull to find an good tolerance in |
160 | -- 2d approximation. |
161 | ---Warning: Used only if Nb2dCurve > 0 |
162 | raises NotImplemented |
163 | is virtual; |
164 | |
165 | |
166 | GetTolerance(me; |
167 | BoundTol, SurfTol, AngleTol : Real; |
168 | Tol3d : out Array1OfReal) |
169 | ---Purpose: Returns the tolerance to reach in approximation |
170 | -- to satisfy. |
171 | -- BoundTol error at the Boundary |
172 | -- AngleTol tangent error at the Boundary (in radian) |
173 | -- SurfTol error inside the surface. |
174 | is deferred; |
175 | |
176 | |
177 | SetTolerance(me : mutable; Tol3d, Tol2d : Real) |
178 | ---Purpose: Is usefull, if (me) have to run numerical |
179 | -- algorithm to perform D0, D1 or D2 |
180 | is deferred; |
181 | |
182 | BarycentreOfSurf(me) |
183 | ---Purpose: Get the barycentre of Surface. |
184 | -- An very poor estimation is sufficent. |
185 | -- This information is usefull to perform well |
186 | -- conditioned rational approximation. |
187 | -- Warning: Used only if <me> IsRational |
188 | returns Pnt from gp |
189 | raises NotImplemented |
190 | is virtual; |
191 | |
192 | |
193 | MaximalSection(me) returns Real |
194 | ---Purpose: Returns the length of the greater section. This |
195 | -- information is usefull to G1's control. |
196 | -- Warning: With an little value, approximation can be slower. |
197 | raises NotImplemented |
198 | is virtual; |
199 | |
200 | GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd) |
201 | ---Purpose: Compute the minimal value of weight for each poles |
202 | -- in all sections. |
203 | -- This information is usefull to control error |
204 | -- in rational approximation. |
205 | -- Warning: Used only if <me> IsRational |
206 | raises NotImplemented |
207 | is virtual; |
208 | |
209 | end SweepFunction; |