b311480e |
1 | -- Created on: 1998-05-12 |
2 | -- Created by: Philippe NOUAILLE |
3 | -- Copyright (c) 1998-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 | deferred class AppFuncRoot from BRepBlend inherits SweepFunction from Approx |
23 | |
24 | ---Purpose: Function to approximate by AppSurface |
25 | ---Level: Advanced |
26 | |
27 | uses |
28 | Line from BRepBlend, |
29 | Point from Blend, |
30 | AppFunction from Blend, |
31 | Shape from GeomAbs, |
32 | Vector from math, |
33 | Pnt from gp, |
34 | Array1OfPnt from TColgp, |
35 | Array1OfPnt2d from TColgp, |
36 | Array1OfVec from TColgp, |
37 | Array1OfVec2d from TColgp, |
38 | Array1OfReal from TColStd, |
39 | Array1OfInteger from TColStd, |
40 | HArray1OfPnt from TColgp, |
41 | HArray1OfPnt2d from TColgp, |
42 | HArray1OfVec from TColgp, |
43 | HArray1OfVec2d from TColgp, |
44 | HArray1OfReal from TColStd |
45 | |
46 | |
47 | raises OutOfRange |
48 | |
49 | is |
50 | Initialize(Line : in out Line from BRepBlend; |
51 | Func : in out AppFunction from Blend; |
52 | Tol3d : Real from Standard; |
53 | Tol2d : Real from Standard) |
54 | ---Warning: The Object Func cannot be killed before me. |
55 | returns AppFuncRoot; |
56 | |
57 | -- |
58 | -- To compute Sections and derivatives Sections |
59 | -- |
60 | -- |
61 | |
62 | D0(me : mutable; |
63 | Param: Real; |
64 | First, Last : Real; |
65 | Poles : out Array1OfPnt from TColgp; |
66 | Poles2d : out Array1OfPnt2d from TColgp; |
67 | Weigths : out Array1OfReal from TColStd) |
68 | ---Purpose: compute the section for v = param |
69 | returns Boolean is redefined; |
70 | |
71 | D1(me : mutable; |
72 | Param: Real; |
73 | First, Last : Real; |
74 | Poles : out Array1OfPnt from TColgp; |
75 | DPoles : out Array1OfVec from TColgp; |
76 | Poles2d : out Array1OfPnt2d from TColgp; |
77 | DPoles2d : out Array1OfVec2d from TColgp; |
78 | Weigths : out Array1OfReal from TColStd; |
79 | DWeigths : out Array1OfReal from TColStd) |
80 | ---Purpose: compute the first derivative in v direction of the |
81 | -- section for v = param |
82 | returns Boolean |
83 | is redefined; |
84 | |
85 | D2(me : mutable; |
86 | Param: Real; |
87 | First, Last : Real; |
88 | Poles : out Array1OfPnt from TColgp; |
89 | DPoles : out Array1OfVec from TColgp; |
90 | D2Poles : out Array1OfVec from TColgp; |
91 | Poles2d : out Array1OfPnt2d from TColgp; |
92 | DPoles2d : out Array1OfVec2d from TColgp; |
93 | D2Poles2d : out Array1OfVec2d from TColgp; |
94 | Weigths : out Array1OfReal from TColStd; |
95 | DWeigths : out Array1OfReal from TColStd; |
96 | D2Weigths : out Array1OfReal from TColStd) |
97 | ---Purpose: compute the second derivative in v direction of the |
98 | -- section for v = param |
99 | returns Boolean |
100 | is redefined; |
101 | |
102 | -- |
103 | -- General Information On The Function |
104 | -- |
105 | |
106 | Nb2dCurves(me) |
107 | ---Purpose: get the number of 2d curves to approximate. |
108 | returns Integer |
109 | is redefined; |
110 | |
111 | SectionShape(me; NbPoles : out Integer from Standard; |
112 | NbKnots : out Integer from Standard; |
113 | Degree : out Integer from Standard) |
114 | ---Purpose: get the format of an section |
115 | is redefined; |
116 | |
117 | Knots(me; TKnots: out Array1OfReal from TColStd) |
118 | ---Purpose: get the Knots of the section |
119 | is redefined; |
120 | |
121 | |
122 | Mults(me; TMults: out Array1OfInteger from TColStd) |
123 | ---Purpose: get the Multplicities of the section |
124 | is redefined; |
125 | |
126 | |
127 | IsRational(me) |
128 | ---Purpose: Returns if the section is rationnal or not |
129 | returns Boolean |
130 | is redefined; |
131 | |
132 | |
133 | |
134 | -- |
135 | -- Mangement of continuity |
136 | -- |
137 | |
138 | NbIntervals(me; S : Shape from GeomAbs) |
139 | ---Purpose: Returns the number of intervals for continuity |
140 | -- <S>. May be one if Continuity(me) >= <S> |
141 | returns Integer |
142 | is redefined; |
143 | |
144 | Intervals(me; T : in out Array1OfReal from TColStd; |
145 | S : Shape from GeomAbs) |
146 | ---Purpose: Stores in <T> the parameters bounding the intervals |
147 | -- of continuity <S>. |
148 | -- |
149 | -- The array must provide enough room to accomodate |
150 | -- for the parameters. i.e. T.Length() > NbIntervals() |
151 | raises |
152 | OutOfRange from Standard |
153 | is redefined; |
154 | |
155 | |
156 | SetInterval(me: mutable; First, Last: Real from Standard) |
157 | ---Purpose: Sets the bounds of the parametric interval on |
158 | -- the fonction |
159 | -- This determines the derivatives in these values if the |
160 | -- function is not Cn. |
161 | is redefined; |
162 | |
163 | |
164 | -- |
165 | -- To help computation of Tolerance |
166 | -- |
167 | -- Evaluation of error, in 2d space, or on rational function, is |
168 | -- dificult. The folowing methodes can help |
169 | -- |
170 | -- |
171 | |
172 | |
173 | Resolution(me; |
174 | Index : Integer from Standard; |
175 | Tol : Real from Standard; |
176 | TolU, TolV : out Real from Standard) |
177 | ---Purpose: Returns the resolutions in the sub-space 2d <Index> -- |
178 | -- This information is usfull to find an good tolerance in |
179 | -- 2d approximation |
180 | |
181 | ---Warning: Used only if Nb2dCurve > 0 |
182 | is redefined; |
183 | |
184 | |
185 | GetTolerance(me; |
186 | BoundTol, SurfTol, AngleTol : Real; |
187 | Tol3d : out Array1OfReal) |
188 | ---Purpose: Returns the tolerance to reach in approximation |
189 | -- to respecte |
190 | -- BoundTol error at the Boundary |
191 | -- AngleTol tangent error at the Boundary (in radian) |
192 | -- SurfTol error inside the surface. |
193 | is redefined; |
194 | |
195 | SetTolerance(me : mutable; Tol3d, Tol2d : Real) |
196 | ---Purpose: Is usfull, if (me) have to be run numerical |
197 | -- algorithme to perform D0, D1 or D2 |
198 | is redefined; |
199 | |
200 | BarycentreOfSurf(me) |
201 | ---Purpose: Get the barycentre of Surface. An very poor |
202 | -- estimation is sufficent. This information is usefull |
203 | -- to perform well conditionned rational approximation. |
204 | |
205 | ---Warning: Used only if <me> IsRational |
206 | returns Pnt from gp |
207 | is redefined; |
208 | |
209 | |
210 | MaximalSection(me) returns Real |
211 | ---Purpose: Returns the length of the maximum section. This |
212 | -- information is usefull to perform well conditionned rational |
213 | -- approximation. |
214 | |
215 | ---Warning: Used only if <me> IsRational |
216 | is redefined; |
217 | |
218 | GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd) |
219 | ---Purpose: Compute the minimal value of weight for each poles |
220 | -- of all sections. This information is usefull to |
221 | -- perform well conditionned rational approximation. |
222 | |
223 | ---Warning: Used only if <me> IsRational |
224 | is redefined; |
225 | |
226 | -- Private methods |
227 | |
228 | SearchPoint(me:mutable; |
229 | Func : in out AppFunction from Blend; |
230 | Param : Real; |
231 | Pnt : in out Point from Blend) |
232 | returns Boolean |
233 | is private; |
234 | |
235 | SearchLocation(me; |
236 | Param : Real; |
237 | FirstIndex, LastIndex : Integer; |
238 | ParamIndex : in out Integer) |
239 | returns Boolean |
240 | raises OutOfRange |
241 | is private; |
242 | |
243 | Point(me; |
244 | Func : AppFunction from Blend; |
245 | Param : Real; |
246 | Sol : Vector from math; |
247 | Pnt : in out Point from Blend) |
248 | is deferred; |
249 | |
250 | Vec(me; |
251 | Sol : in out Vector from math; |
252 | Pnt : Point from Blend) |
253 | is deferred; |
254 | |
255 | fields |
256 | |
257 | myLine : Line from BRepBlend; |
258 | myFunc : Address; |
259 | mydimension : Integer; |
260 | myTolerance : Vector; |
261 | myPnt : Point from Blend; |
262 | myBary : Pnt from gp; |
263 | |
264 | X1, X2, XInit, Sol : Vector from math; |
265 | |
266 | end AppFuncRoot; |