0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / GeomFill / GeomFill_ConstrainedFilling.cdl
1 -- Created on: 1995-10-13
2 -- Created by: Laurent BOURESCHE
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
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.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class ConstrainedFilling from GeomFill
18
19         ---Purpose: An algorithm for constructing a BSpline surface filled
20         -- from a series of boundaries which serve as path
21         -- constraints and optionally, as tangency constraints.
22         -- The algorithm accepts three or four curves as the
23         -- boundaries of the target surface.
24     -- The only FillingStyle used is Coons.
25         -- A ConstrainedFilling object provides a framework for:
26         -- -   defining the boundaries of the surface
27         -- -   implementing the construction algorithm
28         -- -   consulting the result.
29         -- Warning
30         -- This surface filling algorithm is specifically designed to
31         -- be used in connection with fillets. Satisfactory results
32         -- cannot be guaranteed for other uses.
33
34 uses
35
36     HArray1OfInteger from TColStd,
37     HArray1OfReal    from TColStd,
38     Pnt              from gp,
39     Vec              from gp,
40     HArray1OfPnt     from TColgp,
41     HArray2OfPnt     from TColgp,
42     CornerState      from GeomFill,
43     Boundary         from GeomFill,
44     BoundWithSurf    from GeomFill,
45     CoonsAlgPatch    from GeomFill,
46     TgtField         from GeomFill,
47     BSplineSurface   from Geom,
48     Function         from Law
49
50 is
51
52     Create (MaxDeg, MaxSeg : Integer from Standard)
53     returns ConstrainedFilling from GeomFill;
54         ---Purpose:
55         -- Constructs an empty framework for filling a surface from boundaries.
56         -- The boundaries of the surface will be defined, and the
57         -- surface will be built by using the function Init.
58         -- The surface will respect the following constraints:
59         -- -   its degree will not be greater than MaxDeg
60         -- -   the maximum number of segments MaxSeg which
61         --   BSpline surfaces can have.   
62  
63
64     Init(me           : in out;
65          B1,B2,B3     : Boundary from GeomFill;
66          NoCheck      : Boolean from Standard = Standard_False);
67
68     Init(me           : in out;
69          B1,B2,B3,B4  : Boundary from GeomFill;
70          NoCheck      : Boolean from Standard = Standard_False);
71         ---Purpose: Constructs a BSpline surface filled from the series of
72         -- boundaries B1, B2, B3 and, if need be, B4, which serve:
73         -- -   as path constraints
74         -- -   and optionally, as tangency constraints if they are
75         --   GeomFill_BoundWithSurf curves.
76         -- The boundaries may be given in any order: they are
77         -- classified and if necessary, reversed and reparameterized.
78         -- The surface will also respect the following constraints:
79         -- -   its degree will not be greater than the maximum
80         --   degree defined at the time of construction of this framework, and
81         -- -   the maximum number of segments MaxSeg which BSpline surfaces can have     
82     
83
84     SetDomain(me : in out;
85               l  : Real from Standard;
86               B  : BoundWithSurf from GeomFill);
87     ---Purpose: Allows to modify domain on witch the blending function
88     --          associated to  the constrained boundary B  will propag
89     --          the  influence   of the  field   of  tangency.  Can be
90     --          usefull to  reduce  influence of boundaries  on whitch
91     --          the Coons compatibility  conditions are not respected.
92     --          l is a  relative value of  the parametric range of  B.
93     --          Default value for l is 1 (used in Init).
94     --  Warning: Must be called after  Init with a constrained boundary
95     --          used in the call to Init.
96     
97     ReBuild(me : in out)
98     ---Purpose: Computes the  new poles  of  the surface using the  new
99     --          blending  functions set by several calls to SetDomain.
100     is static;
101
102     --------------------------------------------------------------------
103
104     Boundary(me; I : Integer from Standard) 
105     returns Boundary from GeomFill;
106     ---Purpose: Returns the bound of index i after sort.
107
108     Surface(me) returns BSplineSurface from Geom;
109     ---Purpose: Returns the BSpline surface after computation of the fill by this framework.
110
111     --------------------------------------------------------------------
112
113
114     --------------------------------------------------------------------
115     -- Internal use computation functions 
116     --------------------------------------------------------------------
117
118     Build(me : in out)
119     ---Purpose: Performs the approximation an compute  the poles of the
120     --          surface.
121     is static private;
122     
123     PerformApprox(me : in out)
124     ---Purpose: Performs  the  parallel approximation  on two  oppsite
125     --          bounds
126     is static private;
127     
128     MatchKnots(me : in out)
129     ---Purpose: matches  the nodal vectors  of the  blending functions
130     --          and the results  of the approx   to allow the  surface
131     --          computation.
132     is static private;
133     
134     PerformS0(me : in out)
135     ---Purpose: performs the poles of the partial construction S0.
136     is static private;
137     
138     PerformS1(me : in out)
139     ---Purpose: performs the poles of the partial construction S1.
140     is static private;
141     
142     PerformSurface(me : in out)
143     ---Purpose: performs  the poles of  the  surface using the partial
144     --          constructions S0 and S1.
145     is static private;
146     
147     CheckTgte(me : in out; I : Integer from Standard)
148     ---Purpose: Checks if the field of tangency doesn t twist along the 
149     --          boundary.
150     returns Boolean from Standard
151     is static private;
152
153     MinTgte(me : in out; I : Integer from Standard)
154     ---Purpose: Evaluates  the min magnitude  of  the field of tangency
155     --          along bound  I  to allow a   simple evaluation of  the
156     --          tolerance needed for the approximation of the field of
157     --          tangency.
158     is static private;
159
160     Eval(me;
161          W      : Real         from Standard ;
162          Ord    : Integer      from Standard ;
163          Result : in out  Real from Standard)
164     ---Purpose: Internal use for Advmath approximation call. 
165     returns Integer from Standard;
166     
167     --------------------------------------------------------------------
168     -- Internal use functions for debug :
169     -- The graphic traces are compiled only with -D DEB option,
170     -- can be used only in Draw Appli context. 
171     --------------------------------------------------------------------
172
173     CheckCoonsAlgPatch(me : in out; I : Integer from Standard)
174     ---Purpose: Computes the fields of tangents on 30 points along the
175     --          bound  I, these  are  not the  constraint tangents but
176     --          gives an idea of the coonsAlgPatch regularity.
177     is static;
178
179     CheckTgteField(me : in out; I : Integer from Standard)
180     ---Purpose: Computes  the fields  of tangents  and  normals on  30
181     --          points along the bound  I, draw them, and computes the
182     --          max dot product that must be near than 0.
183     is static;
184
185     CheckApprox(me : in out; I : Integer from Standard)
186     ---Purpose: Computes  values  and normals  along  the bound  I and
187     --          compare  them to the  approx  result curves (bound and
188     --          tgte field) , draw  the normals and tangents.
189     is static;
190
191     
192     CheckResult(me : in out; I : Integer from Standard)
193     ---Purpose: Computes values and normals along the  bound I on both
194     --          constraint  surface    and result  surface,  draw  the
195     --          normals, and  computes the max distance between values
196     --          and the max angle  between normals.
197     is static;
198
199     
200 fields
201
202     -- data for approximation.
203     degmax : Integer from Standard;
204     segmax : Integer from Standard;
205
206     -- the algorithmic patch.
207     ptch : CoonsAlgPatch from GeomFill;
208
209     -- the algorithmic tangents fields
210     tgalg :  TgtField from GeomFill[4];
211
212     -- the evaluation  of the min  of the algorithmic  tangents fields
213     -- magnitude.
214     mig : Real from Standard [4];
215     
216     -- data about corners conditionning the existence of solution.
217     stcor : CornerState from GeomFill [4];
218     
219     -- the derivatives on corners.
220     v        : Vec from gp [4];
221
222     -- result curves of aproximation.
223     appdone   : Boolean from Standard;
224     degree    : Integer from Standard [2];
225     curvpol   : HArray1OfPnt from TColgp [4];
226     tgtepol   : HArray1OfPnt from TColgp [4];
227     mults     : HArray1OfInteger from TColStd [2];
228     knots     : HArray1OfReal from TColStd [2];
229
230     -- the blending functions for  the patial result S0 surface  (only
231     -- bounds)
232     ab  : HArray1OfReal from TColStd [4];
233
234     -- the  blending  functions for  the   patial  result  S1  surface
235     -- (including   tangency constraints)
236     pq  : HArray1OfReal from TColStd [4];
237     dom : Real from Standard [4];
238
239     -- new arrays computed in  order  to match the blending  functions
240     -- nodal vectors and the  approximated curves nodal vectors. these
241     -- data are recomputed at each call to ReBuild method, without any
242     -- new perform of the approx.
243     ncpol : HArray1OfPnt from TColgp [4];
244     ntpol : HArray1OfPnt from TColgp [4];
245     nm    : HArray1OfInteger from TColStd [2];
246     nk    : HArray1OfReal from TColStd [2];
247
248     -- nombre de courbes a approximer pour chaque bord ctr[i]
249     ibound: Integer [2];
250     ctr   : Integer [2]; 
251     nbd3  : Integer;
252
253     -- partial  results of surface poles  computed by blending curvpol
254     -- an tgtepol.
255     S0 : HArray2OfPnt from TColgp;
256     S1 : HArray2OfPnt from TColgp;
257
258     -- the result surface.
259     surf : BSplineSurface from Geom;
260     
261 end ConstrainedFilling;