7fd59977 |
1 | -- File: BRepExtrema_DistShapeShape.cdl |
2 | -- Created: Tue Apr 9 14:29:10 1996 |
3 | -- Author: Maria PUMBORIOS |
4 | -- Author: Herve LOUESSARD |
5 | -- <mps@sgi30> |
6 | ---Copyright: Matra Datavision 1996 |
7 | |
8 | |
9 | class DistShapeShape from BRepExtrema |
10 | ---Purpose: This class provides tools to compute minimum distance |
11 | -- between two Shapes (Compound,CompSolid, Solid, Shell, Face, Wire, Edge, Vertex). |
12 | |
13 | uses |
14 | |
15 | IndexedMapOfShape from TopTools, |
16 | Boolean, Integer, OutOfRange from Standard, |
17 | Pnt from gp, |
18 | SupportType,SeqOfSolution from BRepExtrema, |
19 | Shape from TopoDS, |
20 | Box, SeqOfBox from Bnd, |
21 | NotDone from StdFail |
22 | |
23 | raises |
24 | |
25 | NotDone from StdFail, |
26 | OutOfRange from Standard, |
27 | UnCompatibleShape from BRepExtrema |
28 | |
29 | |
30 | is |
31 | |
32 | -- -- the computation of the minimum distance is made in the constructor |
33 | |
34 | Create returns DistShapeShape from BRepExtrema; |
35 | ---Purpose: create empty brepextrema |
36 | |
37 | Create(Shape1 : Shape from TopoDS; |
38 | Shape2 : Shape from TopoDS) |
39 | ---Purpose: computation of the minimum distance (value and |
40 | -- couple of points) using default deflection |
41 | returns DistShapeShape from BRepExtrema; |
42 | |
43 | Create(Shape1 : Shape from TopoDS; |
44 | Shape2 : Shape from TopoDS; |
45 | theDeflection : Real from Standard) |
46 | ---Purpose: Creates brepextrema and load both shapes into it |
47 | -- Default value is Precision::Confusion(). |
48 | -- |
49 | -- Computation of the minimum distance (value and |
50 | -- couple of points). Parameter theDeflection is used |
51 | -- to specify a maximum deviation of extreme distances |
52 | -- from the minimum one. |
53 | -- Default value is Precision::Confusion(). |
54 | returns DistShapeShape from BRepExtrema; |
55 | |
56 | SetDeflection(me: in out; theDeflection : Real from Standard); |
57 | -- Default value is Precision::Confusion(). |
58 | |
59 | LoadS1(me: in out; Shape1 : Shape from TopoDS); |
60 | ---Purpose: load first shape into extrema |
61 | |
62 | LoadS2(me: in out; Shape1 : Shape from TopoDS); |
63 | ---Purpose: load second shape into extrema |
64 | |
65 | Perform(me: in out) returns Boolean from Standard; |
66 | ---Purpose: computation of the minimum distance (value and |
67 | -- couple of points). Parameter theDeflection is used |
68 | -- to specify a maximum deviation of extreme distances |
69 | -- from the minimum one. |
70 | -- Returns IsDone status. |
71 | |
72 | -- the following method is only used in the computation of |
73 | -- minimum distance |
74 | |
75 | DistanceMapMap(me :in out; Map1, Map2: IndexedMapOfShape from TopTools; |
76 | LBox1, LBox2: SeqOfBox from Bnd) |
77 | ---Purpose: computes the minimum distance between two map of |
78 | -- shapes(Face,Edge,Vertex) |
79 | is private; |
80 | |
81 | --- methods giving informations about the solutions |
82 | |
83 | |
84 | IsDone(me) returns Boolean from Standard; |
85 | ---Purpose: True if the minimum distance is found. |
86 | |
87 | |
88 | |
89 | NbSolution(me) returns Integer from Standard |
90 | ---Purpose: Returns the number of solutions satisfying the minimum |
91 | -- distance. |
92 | raises NotDone from StdFail; |
93 | |
94 | |
95 | |
96 | Value(me) returns Real from Standard |
97 | ---Purpose: Returns the value of the minimum distance. |
98 | raises NotDone from StdFail; |
99 | |
100 | |
101 | |
102 | InnerSolution (me) returns Boolean from Standard; |
103 | ---Purpose: True if one of the shapes is a solid and the |
104 | -- other shape is completely or partially inside the solid. |
105 | |
106 | |
107 | PointOnShape1(me; N : Integer from Standard) returns Pnt from gp |
108 | ---Purpose: Returns the Point corresponding to the <N>th |
109 | -- solution on the first Shape |
110 | raises NotDone from StdFail, |
111 | OutOfRange from Standard; |
112 | |
113 | |
114 | PointOnShape2(me; N : Integer from Standard) returns Pnt from gp |
115 | ---Purpose: Returns the Point corresponding to the <N>th |
116 | -- solution on the second Shape |
117 | raises NotDone from StdFail, |
118 | OutOfRange from Standard; |
119 | |
120 | |
121 | SupportTypeShape1(me; N : Integer from Standard) |
122 | returns SupportType from BRepExtrema |
123 | ---Purpose: gives the type of the support where the Nth |
124 | -- solution on the first shape is situated: |
125 | -- IsVertex : |
126 | -- => the Nth solution on the first shape is a Vertex |
127 | -- IsOnEdge |
128 | -- => the Nth soluion on the first shape is on a Edge |
129 | -- IsInFace |
130 | -- => the Nth solution on the first shape is inside a |
131 | -- face |
132 | -- |
133 | -- the corresponding support is obtained by the |
134 | -- method SupportOnShape1 |
135 | raises NotDone from StdFail, |
136 | OutOfRange from Standard; |
137 | |
138 | |
139 | SupportTypeShape2(me; N : Integer from Standard) |
140 | returns SupportType from BRepExtrema |
141 | ---Purpose: gives the type of the support where the Nth |
142 | -- solution on the second shape is situated: |
143 | -- IsVertex : |
144 | -- => the Nth solution on the second shape is a Vertex |
145 | -- IsOnEdge |
146 | -- => the Nth soluion on the secondt shape is on a Edge |
147 | -- IsInFace |
148 | -- => the Nth solution on the second shape is inside a |
149 | -- face |
150 | -- |
151 | -- the support is obtained by the method SupportOnShape2 |
152 | raises NotDone from StdFail, |
153 | OutOfRange from Standard; |
154 | |
155 | |
156 | SupportOnShape1(me; N : Integer from Standard) returns Shape from TopoDS |
157 | ---Purpose :gives the support where the Nth |
158 | -- solution on the first shape is situated. |
159 | -- This support can be a Vertex, an Edge or a Face. |
160 | raises NotDone from StdFail, |
161 | OutOfRange from Standard; |
162 | |
163 | |
164 | SupportOnShape2(me; N : Integer from Standard) returns Shape from TopoDS |
165 | ---Purpose: gives the support where the Nth |
166 | -- solution on the second shape is situated. |
167 | -- This support can be a Vertex, an Edge or a Face. |
168 | raises NotDone from StdFail, |
169 | OutOfRange from Standard; |
170 | |
171 | |
172 | ParOnEdgeS1(me; N: Integer from Standard; t: out Real from Standard) |
173 | ---Purpose: gives the corresponding parameter t if the Nth |
174 | -- Solution is situated on an Egde of the first shape |
175 | raises UnCompatibleShape, |
176 | NotDone from StdFail, |
177 | OutOfRange from Standard; |
178 | |
179 | |
180 | ParOnEdgeS2(me; N: Integer from Standard; t: out Real from Standard) |
181 | ---Purpose: gives the corresponding parameter t if the Nth |
182 | -- Solution is situated on an Egde of the first shape |
183 | raises UnCompatibleShape, |
184 | NotDone from StdFail, |
185 | OutOfRange from Standard; |
186 | |
187 | |
188 | ParOnFaceS1(me; N: Integer from Standard; u: out Real from Standard; |
189 | v:out Real from Standard) |
190 | ---Purpose: gives the corresponding parameters (U,V) if the Nth |
191 | -- Solution is situated on an face of the first shape |
192 | raises UnCompatibleShape, |
193 | NotDone from StdFail, |
194 | OutOfRange from Standard; |
195 | |
196 | |
197 | ParOnFaceS2(me; N: Integer from Standard; u: out Real from Standard; |
198 | v:out Real from Standard) |
199 | ---Purpose: gives the corresponding parameters (U,V) if the Nth |
200 | -- Solution is situated on an Face of the second shape |
201 | raises UnCompatibleShape, |
202 | NotDone from StdFail, |
203 | OutOfRange from Standard; |
204 | |
205 | Dump(me ; o : in out OStream); |
206 | ---Purpose: Prints on the stream o information on the current state |
207 | -- of the object. |
208 | -- |
209 | |
210 | fields |
211 | |
212 | myNbSolution : Integer from Standard; |
213 | myDistRef : Real from Standard; |
214 | myDistValue : Real from Standard; |
215 | myIsDone : Boolean from Standard; |
216 | ListeDeSolutionShape1 : SeqOfSolution from BRepExtrema; |
217 | ListeDeSolutionShape2 : SeqOfSolution from BRepExtrema; |
218 | myInnerSol : Boolean from Standard; |
219 | myEps : Real from Standard; |
220 | myShape1 : Shape from TopoDS; |
221 | myShape2 : Shape from TopoDS; |
222 | myMapV1 : IndexedMapOfShape from TopTools; |
223 | myMapV2 : IndexedMapOfShape from TopTools; |
224 | myMapE1 : IndexedMapOfShape from TopTools; |
225 | myMapE2 : IndexedMapOfShape from TopTools; |
226 | myMapF1 : IndexedMapOfShape from TopTools; |
227 | myMapF2 : IndexedMapOfShape from TopTools; |
228 | |
229 | end DistShapeShape; |