Integration of OCCT 6.5.0 from SVN
[occt.git] / src / HLRBRep / HLRBRep_PolyAlgo.cdl
1 -- File:        PolyAlgo.cdl
2 -- Created:     Tue Feb 18 10:36:07 1992
3 -- Author:      Christophe MARION
4 --              <cma@sdsun1>
5 ---Copyright:    Matra Datavision 1992
6
7 class PolyAlgo from HLRBRep inherits TShared from MMgt
8
9         ---Purpose:  A framework to compute the shape as seen in
10         -- a projection plane. This is done by calculating
11         -- the visible and the hidden parts of the shape.
12         -- HLRBRep_PolyAlgo works with three types of entity:
13         -- -   shapes to be visualized (these shapes must
14         --   have already been triangulated.)
15         -- -   edges in these shapes (these edges are
16         --   defined as polygonal lines on the
17         --   triangulation of the shape, and are the basic
18         --   entities which will be visualized or hidden), and
19         -- -   triangles in these shapes which hide the edges.
20         --   HLRBRep_PolyAlgo is based on the principle
21         -- of comparing each edge of the shape to be
22         -- visualized with each of the triangles produced
23         -- by the triangulation of the shape, and
24         -- calculating the visible and the hidden parts of each edge.
25         -- For a given projection, HLRBRep_PolyAlgo
26         -- calculates a set of lines characteristic of the
27         -- object being represented. It is also used in
28         -- conjunction with the HLRBRep_PolyHLRToShape extraction
29         -- utilities, which reconstruct a new, simplified
30         -- shape from a selection of calculation results.
31         -- This new shape is made up of edges, which
32         -- represent the shape visualized in the projection.
33         -- HLRBRep_PolyAlgo works with a polyhedral
34         -- simplification of the shape whereas
35         -- HLRBRep_Algo takes the shape itself into
36         -- account. When you use HLRBRep_Algo, you
37         -- obtain an exact result, whereas, when you use
38         -- HLRBRep_PolyAlgo, you reduce computation
39         -- time but obtain polygonal segments.
40         -- An HLRBRep_PolyAlgo object provides a framework for:
41         -- -   defining the point of view
42         -- -   identifying the shape or shapes to be visualized
43         -- -   calculating the outlines
44         -- -   calculating the visible and hidden lines of the shape.
45         --   Warning
46         -- -   Superimposed lines are not eliminated by this algorithm.
47         -- -   There must be no unfinished objects inside the shape you wish to visualize.
48         -- -   Points are not treated.
49         -- -   Note that this is not the sort of algorithm
50         --   used in generating shading, which calculates
51         --   the visible and hidden parts of each face in a
52         --   shape to be visualized by comparing each
53         --   face in the shape with every other face in the same shape.
54
55 uses
56     Address           from Standard,
57     Boolean           from Standard,
58     Integer           from Standard,
59     Real              from Standard,
60     Array1OfInteger   from TColStd,
61     Array1OfTransient from TColStd,
62     SequenceOfShape   from TopTools,
63     IndexedMapOfShape from TopTools,
64     MapOfShape        from TopTools,
65     ListOfShape       from TopTools,
66     Shape             from GeomAbs,
67     Edge              from TopoDS,
68     Shape             from TopoDS,
69     Surface           from Geom,
70     Curve2d           from BRepAdaptor,
71     Curve             from BRepAdaptor,
72     Surface           from BRepAdaptor,
73     PolyInternalData  from HLRAlgo,
74     ListOfBPoint      from HLRAlgo,
75     TriangleData      from HLRAlgo,
76     Projector         from HLRAlgo,
77     EdgeStatus        from HLRAlgo,
78     PolyAlgo          from HLRAlgo
79
80 raises
81     OutOfRange   from Standard
82     
83 is
84     Create
85     returns mutable PolyAlgo from HLRBRep;
86         ---Purpose: Constructs an empty framework for the
87         -- calculation of the visible and hidden lines of a shape in a projection.
88         -- Use the functions:
89         -- -   Projector to define the point of view
90         -- -   Load to select the shape or shapes to be  visualized
91         -- -   Update to compute the visible and hidden lines of the shape.
92         --   Warning
93         -- The shape or shapes to be visualized must have already been triangulated.
94         
95     Create(A : PolyAlgo from HLRBRep)
96     returns mutable PolyAlgo from HLRBRep;
97
98     Create(S : Shape from TopoDS)
99     returns mutable PolyAlgo from HLRBRep;
100     
101     NbShapes(me) returns Integer from Standard
102         ---C++: inline
103     is static;
104     
105     Shape(me : mutable; I : Integer from Standard)
106     returns Shape from TopoDS
107     raises OutOfRange from Standard
108         ---C++: return &
109     is static;
110     
111     Remove(me : mutable; I : Integer from Standard)
112     raises OutOfRange from Standard
113         ---Purpose: remove the Shape of Index <I>.
114     is static;
115
116     Index(me; S : Shape from TopoDS) returns Integer from Standard
117         ---Purpose: return the index of the Shape <S> and  return 0 if
118         --          the Shape <S> is not found.
119     is static;
120
121     Load(me : mutable; S : Shape from TopoDS)
122         ---Purpose: Loads the shape S into this framework.
123         -- Warning S must have already been triangulated.
124         ---C++: inline
125          is static;
126     
127     Algo(me) returns PolyAlgo from HLRAlgo
128     is static;
129     
130     Projector(me) returns Projector from HLRAlgo
131         ---Purpose: Sets the parameters of the view for this framework.
132         -- These parameters are defined by an HLRAlgo_Projector object,
133         -- which is returned by the Projector function on a Prs3d_Projector object.
134         ---C++: return const &
135         ---C++: inline
136     is static;
137     
138     Projector(me : mutable; P : Projector from HLRAlgo)
139         ---C++: inline
140     is static;
141     
142     Angle(me) returns Real from Standard
143         ---C++: inline
144     is static;
145     
146     Angle(me : mutable; Ang : Real from Standard)
147         ---C++: inline
148     is static;
149     
150     TolAngular(me) returns Real from Standard
151         ---C++: inline
152     is static;
153     
154     TolAngular(me : mutable; Tol : Real from Standard)
155         ---C++: inline
156     is static;
157     
158     TolCoef(me) returns Real from Standard
159         ---C++: inline
160     is static;
161     
162     TolCoef(me : mutable; Tol : Real from Standard)
163         ---C++: inline
164     is static;
165     
166     Update(me : mutable)
167         ---Purpose: Launches calculation of outlines of the shape
168         -- visualized by this framework. Used after setting the point of view and
169         -- defining the shape or shapes to be visualized.
170     is static;
171     
172     MakeShape(me) returns Shape from TopoDS
173     is static private;
174
175     InitShape(me      : mutable;
176               Shape   :     Shape   from TopoDS;
177               IsoledF : out Boolean from Standard;
178               IsoledE : out Boolean from Standard)
179     returns Integer from Standard
180     is static private;
181
182     StoreShell(me              : mutable;
183                Shape           :     Shape             from TopoDS;
184                iShell          : out Integer           from Standard;
185                Shell           : out Array1OfTransient from TColStd;
186                IsoledF,IsoledE :     Boolean           from Standard; 
187                ES              : out Array1OfInteger   from TColStd;
188                PD,PID          : out Array1OfTransient from TColStd;
189                ShapeMap1       : out MapOfShape        from TopTools;
190                ShapeMap2       : out MapOfShape        from TopTools)
191     is static private;
192     
193     Normal(me;
194            iNode       :     Integer          from Standard;
195            Nod1Indices :     Address          from Standard;
196            Nod1RValues :     Address          from Standard;
197            TData       : out Address          from Standard;
198            PISeg       : out Address          from Standard;
199            PINod       : out Address          from Standard;
200            orient      :     Boolean          from Standard) 
201     returns Boolean from Standard
202     is static private;
203     
204     AverageNormal(me; iNode       :     Integer from Standard;
205                       Nod1Indices :     Address from Standard;
206                       TData       : out Address from Standard;
207                       PISeg       : out Address from Standard;
208                       PINod       : out Address from Standard;
209                       X,Y,Z       : out Real    from Standard)
210     returns Boolean from Standard
211     is static private;
212
213     AddNormalOnTriangle(me; iTri  :     Integer from Standard;
214                             iNode :     Integer from Standard;
215                             jNode : out Integer from Standard;
216                             TData : out Address from Standard;
217                             PINod : out Address from Standard;
218                             X,Y,Z : out Real    from Standard;
219                             OK    : out Boolean from Standard)
220     is static private;
221
222     InitBiPointsWithConnexity
223         (me     : mutable;
224          e      :     Integer           from Standard;
225          E      : out Edge              from TopoDS;
226          List   : out ListOfBPoint      from HLRAlgo;
227          PID    : out Array1OfTransient from TColStd;
228          LS     : out ListOfShape       from TopTools;
229          connex :     Boolean           from Standard)
230     is static private;
231
232     Interpolation(me;
233                   List           : out ListOfBPoint     from HLRAlgo;
234                   X1  ,Y1  ,Z1   : out Real             from Standard;
235                   X2  ,Y2  ,Z2   : out Real             from Standard;
236                   XTI1,YTI1,ZTI1 : out Real             from Standard;
237                   XTI2,YTI2,ZTI2 : out Real             from Standard;
238                   e              :     Integer          from Standard;
239                   U1,U2          : out Real             from Standard;
240                   Nod11Indices   : out Address          from Standard;
241                   Nod11RValues   : out Address          from Standard;
242                   Nod12Indices   : out Address          from Standard;
243                   Nod12RValues   : out Address          from Standard;
244                   i1p1,i1p2,i1   :     Integer          from Standard;
245                   pid1           :     PolyInternalData from HLRAlgo;
246                   TData1         : out Address          from Standard;
247                   PISeg1         : out Address          from Standard;
248                   PINod1         : out Address          from Standard)
249     is static private;
250
251     Interpolation(me;
252                   List           : out ListOfBPoint     from HLRAlgo;
253                   X1  ,Y1  ,Z1   : out Real             from Standard;
254                   X2  ,Y2  ,Z2   : out Real             from Standard;
255                   XTI1,YTI1,ZTI1 : out Real             from Standard;
256                   XTI2,YTI2,ZTI2 : out Real             from Standard;
257                   e              :     Integer          from Standard;
258                   U1,U2          : out Real             from Standard;
259                   rg             :     Shape            from GeomAbs;
260                   Nod11Indices   : out Address          from Standard;
261                   Nod11RValues   : out Address          from Standard;
262                   Nod12Indices   : out Address          from Standard;
263                   Nod12RValues   : out Address          from Standard;
264                   i1p1,i1p2,i1   :     Integer          from Standard;
265                   pid1           :     PolyInternalData from HLRAlgo;
266                   TData1         : out Address          from Standard;
267                   PISeg1         : out Address          from Standard;
268                   PINod1         : out Address          from Standard;
269                   Nod21Indices   : out Address          from Standard;
270                   Nod21RValues   : out Address          from Standard;
271                   Nod22Indices   : out Address          from Standard;
272                   Nod22RValues   : out Address          from Standard;
273                   i2p1,i2p2,i2   :     Integer          from Standard;
274                   pid2           :     PolyInternalData from HLRAlgo;
275                   TData2         : out Address          from Standard;
276                   PISeg2         : out Address          from Standard;
277                   PINod2         : out Address          from Standard)
278     is static private;
279
280     Interpolation(me;
281                   U1,U2       :     Real    from Standard;
282                   Nod1RValues :     Address from Standard;
283                   Nod2RValues :     Address from Standard;
284                   X3,Y3,Z3    : out Real    from Standard;
285                   XT3,YT3,ZT3 : out Real    from Standard;
286                   coef3,U3    : out Real    from Standard;
287                   mP3P1       : out Boolean from Standard)
288     returns Boolean from Standard
289     is static private;
290
291     MoveOrInsertPoint(me;
292                       List           : out ListOfBPoint     from HLRAlgo;
293                       X1  ,Y1  ,Z1   : out Real             from Standard;
294                       X2  ,Y2  ,Z2   : out Real             from Standard;
295                       XTI1,YTI1,ZTI1 : out Real             from Standard;
296                       XTI2,YTI2,ZTI2 : out Real             from Standard;
297                       e              :     Integer          from Standard;
298                       U1,U2          : out Real             from Standard;
299                       Nod11Indices   : out Address          from Standard;
300                       Nod11RValues   : out Address          from Standard;
301                       Nod12Indices   : out Address          from Standard;
302                       Nod12RValues   : out Address          from Standard;
303                       i1p1,i1p2,i1   :     Integer          from Standard;
304                       pid1           :     PolyInternalData from HLRAlgo;
305                       TData1         : out Address          from Standard;
306                       PISeg1         : out Address          from Standard;
307                       PINod1         : out Address          from Standard;
308                       X3,Y3,Z3       :     Real             from Standard;
309                       XT3,YT3,ZT3    :     Real             from Standard;
310                       coef3          :     Real             from Standard;
311                       U3             :     Real             from Standard;
312                       insP3,mP3P1    :     Boolean          from Standard; 
313                       flag           :     Boolean          from Standard)
314     is static private;
315
316     MoveOrInsertPoint(me;
317                       List           : out ListOfBPoint     from HLRAlgo;
318                       X1  ,Y1  ,Z1   : out Real             from Standard;
319                       X2  ,Y2  ,Z2   : out Real             from Standard;
320                       XTI1,YTI1,ZTI1 : out Real             from Standard;
321                       XTI2,YTI2,ZTI2 : out Real             from Standard;
322                       e              :     Integer          from Standard;
323                       U1,U2          : out Real             from Standard;
324                       Nod11Indices   : out Address          from Standard;
325                       Nod11RValues   : out Address          from Standard;
326                       Nod12Indices   : out Address          from Standard;
327                       Nod12RValues   : out Address          from Standard;
328                       i1p1,i1p2,i1   :     Integer          from Standard;
329                       pid1           :     PolyInternalData from HLRAlgo;
330                       TData1         : out Address          from Standard;
331                       PISeg1         : out Address          from Standard;
332                       PINod1         : out Address          from Standard;
333                       Nod21Indices   : out Address          from Standard;
334                       Nod21RValues   : out Address          from Standard;
335                       Nod22Indices   : out Address          from Standard;
336                       Nod22RValues   : out Address          from Standard;
337                       i2p1,i2p2,i2   :     Integer          from Standard;
338                       pid2           :     PolyInternalData from HLRAlgo;
339                       TData2         : out Address          from Standard;
340                       PISeg2         : out Address          from Standard;
341                       PINod2         : out Address          from Standard;
342                       X3,Y3,Z3       :     Real             from Standard;
343                       XT3,YT3,ZT3    :     Real             from Standard;
344                       coef3          :     Real             from Standard;
345                       U3             :     Real             from Standard;
346                       insP3,mP3P1    :     Boolean          from Standard; 
347                       flag           :     Boolean          from Standard)
348     is static private;
349
350     MoveOrInsertPoint(me;
351                       List           : out ListOfBPoint     from HLRAlgo;
352                       X1  ,Y1  ,Z1   : out Real             from Standard;
353                       X2  ,Y2  ,Z2   : out Real             from Standard;
354                       XTI1,YTI1,ZTI1 : out Real             from Standard;
355                       XTI2,YTI2,ZTI2 : out Real             from Standard;
356                       e              :     Integer          from Standard;
357                       U1,U2          : out Real             from Standard;
358                       Nod11Indices   : out Address          from Standard;
359                       Nod11RValues   : out Address          from Standard;
360                       Nod12Indices   : out Address          from Standard;
361                       Nod12RValues   : out Address          from Standard;
362                       i1p1,i1p2,i1   :     Integer          from Standard;
363                       pid1           :     PolyInternalData from HLRAlgo;
364                       TData1         : out Address          from Standard;
365                       PISeg1         : out Address          from Standard;
366                       PINod1         : out Address          from Standard;
367                       Nod21Indices   : out Address          from Standard;
368                       Nod21RValues   : out Address          from Standard;
369                       Nod22Indices   : out Address          from Standard;
370                       Nod22RValues   : out Address          from Standard;
371                       i2p1,i2p2,i2   :     Integer          from Standard;
372                       pid2           :     PolyInternalData from HLRAlgo;
373                       TData2         : out Address          from Standard;
374                       PISeg2         : out Address          from Standard;
375                       PINod2         : out Address          from Standard;
376                       X3,Y3,Z3       :     Real             from Standard;
377                       XT3,YT3,ZT3    :     Real             from Standard;
378                       coef3          :     Real             from Standard;
379                       U3             :     Real             from Standard;
380                       insP3,mP3P1    :     Boolean          from Standard; 
381                       X4,Y4,Z4       :     Real             from Standard;
382                       XT4,YT4,ZT4    :     Real             from Standard;
383                       coef4          :     Real             from Standard;
384                       U4             :     Real             from Standard;
385                       insP4,mP4P1    :     Boolean          from Standard; 
386                       flag           :     Boolean          from Standard)
387     is static private;
388
389     InsertOnOutLine(me  : mutable;
390                     PID : out Array1OfTransient from TColStd)
391     is static private;
392     
393     CheckFrBackTriangles(me   : mutable;
394                          List : out ListOfBPoint      from HLRAlgo;
395                          PID  : out Array1OfTransient from TColStd)
396     is static private;
397     
398     FindEdgeOnTriangle(me;
399                        Tri1Indices :     Address from Standard; 
400                        ip1,ip2     :     Integer from Standard; 
401                        jtrouv      : out Integer from Standard; 
402                        isDirect    : out Boolean from Standard) 
403     is static private;
404
405     ChangeNode(me;
406                ip1,ip2     :     Integer from Standard;
407                Nod1Indices :     Address from Standard;
408                Nod1RValues :     Address from Standard;
409                Nod2Indices :     Address from Standard;
410                Nod2RValues :     Address from Standard;
411                coef1       :     Real    from Standard;
412                X3,Y3,Z3    :     Real    from Standard;
413                first       :     Boolean from Standard;
414                TData       : out Address from Standard;
415                PISeg       : out Address from Standard;
416                PINod       : out Address from Standard)
417     is static private;
418     
419     UpdateAroundNode(me;
420                      iNode       : Integer from Standard;
421                      Nod1Indices : Address from Standard;
422                      TData       : Address from Standard;
423                      PISeg       : Address from Standard;
424                      PINod       : Address from Standard)
425     is static private;
426
427     OrientTriangle(me ;iTri        : Integer from Standard;
428                        Tri1Indices : Address from Standard;
429                        Nod1Indices : Address from Standard;
430                        Nod1RValues : Address from Standard;
431                        Nod2Indices : Address from Standard;
432                        Nod2RValues : Address from Standard;
433                        Nod3Indices : Address from Standard;
434                        Nod3RValues : Address from Standard)
435     is static private;
436
437     Triangles(me; ip1,ip2     :     Integer from Standard;
438                   Nod1Indices :     Address from Standard;
439                   PISeg       : out Address from Standard;
440                   iTri1,iTri2 : out Integer from Standard)
441     returns Boolean from Standard
442     is static private;
443
444     NewNode(me;
445             Nod1RValues :     Address from Standard;
446             Nod2RValues :     Address from Standard;
447             coef1       : out Real    from Standard;
448             moveP1      : out Boolean from Standard)
449     returns Boolean from Standard
450     is static private;
451     
452     UVNode(me;
453            Nod1RValues :     Address from Standard;
454            Nod2RValues :     Address from Standard;
455            coef1       :     Real    from Standard;
456            U3,V3       : out Real    from Standard)
457     is static private;
458     
459     CheckDegeneratedSegment(me;
460                             Nod1Indices : Address from Standard;
461                             Nod1RValues : Address from Standard;
462                             Nod2Indices : Address from Standard;
463                             Nod2RValues : Address from Standard)
464     is static private;
465
466     UpdateOutLines(me   : mutable;
467                    List : out ListOfBPoint      from HLRAlgo;
468                    PID  : out Array1OfTransient from TColStd)
469     is static private;
470     
471     UpdateEdgesBiPoints(me     : mutable;
472                         List   : out ListOfBPoint      from HLRAlgo;
473                         PID    :     Array1OfTransient from TColStd;
474                         closed :     Boolean           from Standard)
475     is static private;
476     
477     UpdatePolyData(me     : mutable;
478                    PD,PID : out Array1OfTransient from TColStd;
479                    closed :     Boolean           from Standard)
480     is static private;
481     
482     TMultiply(me;
483               X,Y,Z : out Real from Standard;
484               VecPartOnly : Boolean from Standard = Standard_False)
485     is static private;
486     
487     TTMultiply(me;
488                X,Y,Z : out Real from Standard;
489               VecPartOnly : Boolean from Standard = Standard_False)
490     is static private;
491     
492     TIMultiply(me;
493                X,Y,Z : out Real from Standard;
494                VecPartOnly : Boolean from Standard = Standard_False)
495     is static private;
496     
497     InitHide(me : mutable)
498         ---C++: inline
499     is static;
500     
501     MoreHide(me) returns Boolean from Standard
502         ---C++: inline
503     is static;
504     
505     NextHide(me : mutable)
506         ---C++: inline
507     is static;
508     
509     Hide(me : mutable; Coordinates : out Address    from Standard;
510                        status      : out EdgeStatus from HLRAlgo;
511                        S           : out Shape      from TopoDS;
512                        reg1,regn   : out Boolean    from Standard;
513                        outl,intl   : out Boolean    from Standard)
514     is static;
515     
516     InitShow(me : mutable)
517         ---C++: inline
518     is static;
519     
520     MoreShow(me) returns Boolean from Standard
521         ---C++: inline
522     is static;
523     
524     NextShow(me : mutable)
525         ---C++: inline
526     is static;
527     
528     Show(me : mutable; Coordinates : out Address from Standard;
529                        S           : out Shape   from TopoDS;
530                        reg1,regn   : out Boolean from Standard;
531                        outl,intl   : out Boolean from Standard)
532     is static;
533     
534     OutLinedShape(me; S : Shape from TopoDS)
535     returns Shape from TopoDS
536         ---Purpose: Make a shape  with  the internal outlines in  each
537         --          face.
538     is static;
539     
540     Debug(me) returns Boolean from Standard
541         ---C++: inline
542     is static;
543     
544     Debug(me : mutable; B : Boolean from Standard)
545         ---C++: inline
546     is static;
547     
548 fields
549     myProj       : Projector         from HLRAlgo;
550     TMat         : Real              from Standard[3,3];
551     TLoc         : Real              from Standard[3];
552     TTMa         : Real              from Standard[3,3];
553     TTLo         : Real              from Standard[3];
554     TIMa         : Real              from Standard[3,3];
555     TILo         : Real              from Standard[3];
556     myShapes     : SequenceOfShape   from TopTools;
557     myEMap       : IndexedMapOfShape from TopTools;
558     myFMap       : IndexedMapOfShape from TopTools;
559     myAlgo       : PolyAlgo          from HLRAlgo;
560     myHide       : Integer           from Standard;
561     myDebug      : Boolean           from Standard;
562     myAngle      : Real              from Standard;
563     myTolSta     : Real              from Standard;
564     myTolEnd     : Real              from Standard;
565     myTolAngular : Real              from Standard;
566     myGSurf      : Surface           from Geom; 
567     myBSurf      : Surface           from BRepAdaptor;
568     myBCurv      : Curve             from BRepAdaptor;
569     myPC         : Curve2d           from BRepAdaptor;
570
571 end PolyAlgo;