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