Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 2000-10-26 |
2 | -- Created by: Peter KURNEV | |
3 | -- Copyright (c) 2000-2012 OPEN CASCADE SAS | |
4 | -- | |
5 | -- The content of this file is subject to the Open CASCADE Technology Public | |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file | |
7 | -- except in compliance with the License. Please obtain a copy of the License | |
8 | -- at http://www.opencascade.org and read it completely before using this file. | |
9 | -- | |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
12 | -- | |
13 | -- The Original Code and all software distributed under the License is | |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |
15 | -- Initial Developer hereby disclaims all such warranties, including without | |
16 | -- limitation, any warranties of merchantability, fitness for a particular | |
17 | -- purpose or non-infringement. Please see the License for the specific terms | |
18 | -- and conditions governing the rights and limitations under the License. | |
19 | ||
7fd59977 | 20 | |
21 | ||
22 | class EdgeEdge from IntTools | |
23 | ||
24 | ---Purpose: The class provides Edge/Edge algorithm to determine | |
25 | -- common parts between two edges in 3-d space. | |
26 | -- Common parts can be : Vertices or Edges. | |
27 | --- | |
28 | uses | |
29 | Edge from TopoDS, | |
30 | Curve from BRepAdaptor, | |
31 | SequenceOfRoots from IntTools, | |
32 | SequenceOfRanges from IntTools, | |
33 | CArray1OfReal from IntTools, | |
34 | CommonPrt from IntTools, | |
35 | SequenceOfCommonPrts from IntTools, | |
36 | Range from IntTools | |
37 | --raises | |
38 | ||
39 | is | |
40 | Create | |
41 | returns EdgeEdge from IntTools; | |
42 | ---Purpose: | |
43 | --- Empty constructor | |
44 | --- | |
45 | ||
f793011e P |
46 | SetEdge1 (me:out; |
47 | anEdge:Edge from TopoDS); | |
7fd59977 | 48 | ---Purpose: |
49 | --- Sets the first edge | |
50 | --- | |
51 | ||
f793011e P |
52 | SetTolerance1 (me:out; |
53 | aTolEdge1:Real from Standard); | |
7fd59977 | 54 | ---Purpose: |
55 | --- Sets the value of tolerance pipe for the first edge | |
56 | --- | |
57 | ||
f793011e P |
58 | SetEdge2 (me:out; |
59 | anEdge:Edge from TopoDS); | |
7fd59977 | 60 | ---Purpose: |
61 | --- Sets the second edge | |
62 | --- | |
63 | ||
f793011e P |
64 | SetTolerance2 (me:out; |
65 | aTolEdge2:Real from Standard); | |
7fd59977 | 66 | ---Purpose: |
67 | --- Sets the value of tolerance pipe for the first edge | |
68 | --- | |
69 | ||
f793011e P |
70 | SetDiscretize (me:out; |
71 | aDiscret:Integer from Standard); | |
7fd59977 | 72 | ---Purpose: |
73 | --- Sets the number of division for the shortest | |
74 | --- edge among the two. The deflection is not taken | |
75 | --- into account | |
76 | --- | |
77 | ||
f793011e P |
78 | SetDeflection (me:out; |
79 | aDeflection:Real from Standard); | |
7fd59977 | 80 | ---Purpose: |
81 | --- Sets the value of maximum reative deflection between | |
82 | --- the two nearest points on a curve. | |
83 | --- | |
84 | ||
f793011e P |
85 | SetEpsilonT (me:out; |
86 | anEpsT:Real from Standard); | |
7fd59977 | 87 | ---Purpose: |
88 | --- Sets the criteria of equality of two arguments, | |
89 | --- i.e. |t2-t1|<anEpsT will mean that t2=t1 | |
90 | --- | |
91 | ||
f793011e P |
92 | SetEpsilonNull (me:out; |
93 | anEpsNull:Real from Standard); | |
7fd59977 | 94 | ---Purpose: |
95 | --- Sets the criteria of equality of two functions' values | |
96 | --- i.e. |f(t2)-f(t1)|<anEpsNull will mean that f(t2)=f(t1) | |
97 | --- | |
98 | ||
f793011e P |
99 | SetRange1 (me:out; |
100 | aRange:Range from IntTools); | |
7fd59977 | 101 | |
f793011e P |
102 | SetRange2 (me:out; |
103 | aRange:Range from IntTools); | |
7fd59977 | 104 | |
f793011e P |
105 | SetRange1 (me:out; |
106 | aFirst, aLast:Real from Standard); | |
7fd59977 | 107 | |
f793011e P |
108 | SetRange2 (me:out; |
109 | aFirst, aLast:Real from Standard); | |
7fd59977 | 110 | |
111 | Perform(me:out); | |
112 | ---Purpose: | |
113 | --- The main method of the algorithm to determine | |
114 | --- common parts between two edges in 3-d space | |
115 | --- | |
116 | ||
117 | IsDone (me) | |
118 | returns Boolean from Standard; | |
119 | ---Purpose: | |
120 | --- True if the common parts are found | |
121 | --- | |
122 | ||
123 | Order (me) | |
124 | returns Boolean from Standard; | |
125 | ---Purpose: | |
126 | --- False if the common parts are coherented with Edge1, Edge2 | |
127 | --- | |
128 | ||
129 | ErrorStatus(me) | |
130 | returns Integer from Standard; | |
131 | ---Purpose: Returns the number that corresponds to the error. | |
132 | --- The list of error-codes is in ...cxx file | |
133 | --- | |
134 | ||
135 | CommonParts(me) | |
136 | returns SequenceOfCommonPrts from IntTools; | |
137 | ---C++: return const& | |
138 | ---Purpose: | |
139 | --- Returns the common parts (Output) | |
140 | --- | |
141 | ||
142 | Range1 (me) | |
143 | returns Range from IntTools; | |
144 | ---C++: return const& | |
145 | ||
146 | Range2 (me) | |
147 | returns Range from IntTools; | |
148 | ---C++: return const& | |
149 | ||
150 | ----------------------------------------------------- | |
f793011e | 151 | -- Block of protected methods of the algorithm -- |
7fd59977 | 152 | ----------------------------------------------------- |
153 | ||
f793011e P |
154 | CheckData (me:out) |
155 | is protected; | |
7fd59977 | 156 | ---Purpose: |
157 | --- Fool-proof chechking the input data. | |
158 | --- The following data is not available | |
159 | --- * Degenerated edges is not available; | |
160 | --- * Egdes, that don't contain 3d-curve. | |
161 | --- | |
162 | ||
f793011e P |
163 | Prepare (me:out) |
164 | is protected; | |
7fd59977 | 165 | ---Purpose: |
166 | --- Preparing the main fields for the algorithm | |
167 | --- * From-Curve (myCFrom,myTminFrom,myTmaxFrom), | |
168 | --- * To -Curve (myCTo ,myTminTo ,myTmaxTo ), | |
169 | --- * myCreiteria=myTol1+myTol2 , | |
170 | --- * myProjectableRanges. | |
171 | --- | |
172 | ||
f793011e P |
173 | IsProjectable (me; |
174 | t:Real from Standard) | |
175 | returns Integer from Standard | |
176 | is protected; | |
7fd59977 | 177 | ---Purpose: |
178 | --- Returns the flag 1 if it is possible to project | |
179 | --- the point from the From-Curve at the parameter t | |
180 | --- to the To-Curve. | |
181 | --- Othrwise it returns 0. | |
182 | --- | |
f793011e P |
183 | FindRangeOnCurve2 (me:out; |
184 | aCP:out CommonPrt from IntTools) | |
185 | returns Integer from Standard | |
186 | is protected; | |
187 | ---Purpose: | |
188 | --- Find the range on the curve Curve-To that corresponds | |
189 | --- to the given range on the curve Curve-From. | |
190 | --- | |
7fd59977 | 191 | |
f793011e P |
192 | GetParameterOnCurve2 (me; |
193 | aT1:Real from Standard; | |
194 | aT2:out Real from Standard) | |
195 | returns Integer from Standard | |
196 | is protected ; | |
7fd59977 | 197 | ---Purpose: |
f793011e P |
198 | --- Find the value of the parameter on the curve Curve-To |
199 | --- that corresponds to the given parameter on the curve | |
200 | --- Curve-From. | |
7fd59977 | 201 | --- |
f793011e P |
202 | |
203 | TreatVertexType(me:out; | |
204 | am1, am2:Real from Standard; | |
205 | aCP:out CommonPrt from IntTools) | |
206 | returns Integer from Standard | |
207 | is protected; | |
7fd59977 | 208 | |
f793011e P |
209 | IsIntersection (me:out; |
210 | t1 : Real from Standard; | |
211 | t2 : Real from Standard) | |
212 | is protected ; | |
213 | ||
214 | ||
215 | FindDerivativeRoot (me:out; | |
216 | t,f:CArray1OfReal from IntTools) | |
217 | is protected; | |
7fd59977 | 218 | |
f793011e P |
219 | FindSimpleRoot (me:out; |
220 | IP:Integer from Standard; | |
221 | ta, tb, fA:Real from Standard) | |
222 | returns Real from Standard | |
223 | is protected; | |
224 | ---Purpose: | |
225 | --- Find the Root of the function on given interval | |
226 | --- of the argument [ta,tb] using bisection method . | |
227 | --- IP - a flag; | |
228 | --- =1 - use DistanceFunction; | |
229 | --- =2 - use DerivativeFunction; | |
230 | --- | |
231 | ||
232 | DistanceFunction (me:out; | |
233 | t:Real from Standard) | |
234 | returns Real from Standard | |
235 | is protected; | |
7fd59977 | 236 | ---Purpose: |
237 | --- Calculates the DistanceFunction D(t). | |
238 | --- D(t)=D1(t) - myCriteria; | |
239 | --- where | |
240 | --- D1(t) - the lower distance between a point from | |
241 | --- the From-Curve at parameter t and | |
242 | --- projection point of this point on To-Curve; | |
243 | --- myCriteria=myTol1+myTol2. | |
244 | --- | |
245 | ||
f793011e P |
246 | DerivativeFunction (me:out; |
247 | t:Real from Standard) | |
248 | returns Real from Standard | |
249 | is protected; | |
7fd59977 | 250 | ---Purpose: |
251 | --- Calculates the first derivative of | |
252 | --- the DistanceFunction D(t). | |
253 | --- | |
7fd59977 | 254 | |
7fd59977 | 255 | CheckTouch(me: out; |
f793011e P |
256 | aCP: CommonPrt from IntTools; |
257 | t1 : out Real from Standard; | |
258 | t2 : out Real from Standard) | |
259 | returns Boolean from Standard | |
260 | is protected; | |
7fd59977 | 261 | |
262 | CheckTouchVertex(me; | |
f793011e P |
263 | aCP: CommonPrt from IntTools; |
264 | t1 : out Real from Standard; | |
265 | t2 : out Real from Standard) | |
266 | returns Boolean from Standard | |
267 | is protected; | |
268 | ||
7fd59977 | 269 | |
270 | ComputeLineLine(me:out) | |
f793011e P |
271 | is protected; |
272 | ||
273 | --modified by NIZNHY-PKV Mon Oct 31 12:16:55 2011f | |
274 | IsSameCurves(me:out) | |
275 | returns Boolean from Standard | |
276 | is protected; | |
277 | --modified by NIZNHY-PKV Mon Oct 31 12:16:59 2011t | |
278 | ||
7fd59977 | 279 | fields |
280 | -- Data | |
281 | myEdge1 : Edge from TopoDS; | |
282 | myEdge2 : Edge from TopoDS; | |
283 | myTol1 : Real from Standard; | |
284 | myTol2 : Real from Standard; | |
285 | ||
286 | myDiscret : Integer from Standard; | |
287 | ||
288 | myEpsT : Real from Standard; | |
289 | myEpsNull : Real from Standard; | |
290 | myDeflection : Real from Standard; | |
291 | ||
292 | -- data curves | |
293 | myCFrom : Curve from BRepAdaptor; | |
294 | myTminFrom : Real from Standard; | |
295 | myTmaxFrom : Real from Standard; | |
296 | myTolFrom : Real from Standard; | |
297 | ||
298 | myCTo : Curve from BRepAdaptor; | |
299 | myTminTo : Real from Standard; | |
300 | myTmaxTo : Real from Standard; | |
301 | myTolTo : Real from Standard; | |
302 | ||
303 | myCriteria : Real from Standard; | |
f793011e | 304 | |
7fd59977 | 305 | myIsDone : Boolean from Standard; |
306 | myErrorStatus : Integer from Standard; | |
307 | ||
f793011e | 308 | --- internal members |
7fd59977 | 309 | mySeqOfCommonPrts : SequenceOfCommonPrts from IntTools; |
7fd59977 | 310 | myOrder : Boolean from Standard; -- 0-strait; 1-reversed |
311 | myPar1 : Real from Standard; | |
f793011e | 312 | myParallel : Boolean from Standard; |
7fd59977 | 313 | myRange1 : Range from IntTools; |
314 | myRange2 : Range from IntTools; | |
315 | ||
316 | end EdgeEdge; | |
317 |