b311480e |
1 | -- Created on: 1992-11-24 |
2 | -- Created by: Didier PIFFAULT |
3 | -- Copyright (c) 1992-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 | class BoundSortBox from Bnd |
18 | |
19 | ---Purpose: A tool to compare a bounding box or a plane with a set of |
20 | -- bounding boxes. It sorts the set of bounding boxes to give |
21 | -- the list of boxes which intersect the element being compared. |
22 | -- The boxes being sorted generally bound a set of shapes, |
23 | -- while the box being compared bounds a shape to be |
24 | -- compared. The resulting list of intersecting boxes therefore |
25 | -- gives the list of items which potentially intersect the shape to be compared. |
26 | |
27 | |
28 | uses Integer from Standard, |
29 | Real from Standard, |
30 | ListOfInteger from TColStd, |
31 | Pln from gp, |
32 | Box from Bnd, |
33 | HArray1OfBox from Bnd, |
34 | DataMapOfIntegerInteger from TColStd |
35 | |
36 | |
37 | raises NullValue from Standard, MultiplyDefined from Standard |
38 | |
39 | |
40 | is Create returns BoundSortBox from Bnd; |
41 | ---Purpose: Constructs an empty comparison algorithm for bounding boxes. |
42 | -- The bounding boxes are then defined using the Initialize function. |
43 | |
44 | |
45 | Initialize (me : in out; |
46 | CompleteBox : Box from Bnd; |
47 | SetOfBox : HArray1OfBox from Bnd) |
48 | is static; |
49 | ---Purpose: Initializes this comparison algorithm with |
50 | -- - the set of bounding boxes SetOfBox. |
51 | |
52 | Initialize (me : in out; |
53 | SetOfBox : HArray1OfBox from Bnd) |
54 | is static; |
55 | ---Purpose: Initializes this comparison algorithm with |
56 | -- - the set of bounding boxes SetOfBox, where |
57 | -- CompleteBox is given as the global bounding box of SetOfBox. |
58 | |
59 | |
60 | SortBoxes (me : in out) |
61 | raises NullValue from Standard is static private; |
62 | ---Purpose: Prepares BoundSortBox and sorts the boxes of |
63 | -- <SetOfBox> . |
64 | |
65 | |
66 | |
67 | Initialize (me : in out; |
68 | CompleteBox : Box from Bnd; |
69 | nbComponents : Integer from Standard) |
70 | raises NullValue from Standard is static; |
71 | ---Purpose: Initializes this comparison algorithm, giving it only |
72 | -- - the maximum number nbComponents |
73 | -- of the bounding boxes to be managed. Use the Add |
74 | -- function to define the array of bounding boxes to be sorted by this algorithm. |
75 | |
76 | |
77 | Add (me : in out; |
78 | theBox : Box from Bnd; |
79 | boxIndex : Integer from Standard) |
80 | raises MultiplyDefined from Standard is static; |
81 | ---Purpose: Adds the bounding box theBox at position boxIndex in |
82 | -- the array of boxes to be sorted by this comparison algorithm. |
83 | -- This function is used only in conjunction with the third |
84 | -- syntax described in the synopsis of Initialize. |
85 | -- |
86 | -- Exceptions: |
87 | -- |
88 | -- - Standard_OutOfRange if boxIndex is not in the |
89 | -- range [ 1,nbComponents ] where |
90 | -- nbComponents is the maximum number of bounding |
91 | -- boxes declared for this comparison algorithm at |
92 | -- initialization. |
93 | -- |
94 | -- - Standard_MultiplyDefined if a box already exists at |
95 | -- position boxIndex in the array of boxes to be sorted by |
96 | -- this comparison algorithm. |
97 | |
98 | |
99 | Compare (me : in out; |
100 | theBox : Box from Bnd) |
101 | returns ListOfInteger from TColStd |
102 | ---Purpose: Compares the bounding box theBox, |
103 | -- with the set of bounding boxes to be sorted by this |
104 | -- comparison algorithm, and returns the list of intersecting |
105 | -- bounding boxes as a list of indexes on the array of |
106 | -- bounding boxes used by this algorithm. |
107 | ---C++: return const & |
108 | raises NullValue from Standard is static; |
109 | |
110 | Compare (me : in out; |
111 | P : Pln from gp) |
112 | returns ListOfInteger from TColStd |
113 | ---Purpose: Compares the plane P |
114 | -- with the set of bounding boxes to be sorted by this |
115 | -- comparison algorithm, and returns the list of intersecting |
116 | -- bounding boxes as a list of indexes on the array of |
117 | -- bounding boxes used by this algorithm. |
118 | ---C++: return const & |
119 | raises NullValue from Standard is static; |
120 | |
121 | Dump (me) is static; |
122 | |
123 | Destroy(me: in out) |
124 | ---C++: alias ~ |
125 | is static; |
126 | |
127 | fields myBox : Box from Bnd; |
128 | myBndComponents : HArray1OfBox from Bnd; |
129 | Xmin : Real from Standard; |
130 | Ymin : Real from Standard; |
131 | Zmin : Real from Standard; |
132 | deltaX : Real from Standard; |
133 | deltaY : Real from Standard; |
134 | deltaZ : Real from Standard; |
135 | discrX : Integer from Standard; |
136 | discrY : Integer from Standard; |
137 | discrZ : Integer from Standard; |
138 | theFound : Integer from Standard; |
139 | Crible : DataMapOfIntegerInteger from TColStd; |
140 | lastResult : ListOfInteger from TColStd; |
141 | TabBits : Address from Standard; |
142 | end BoundSortBox; |