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