1 -- Created on: 2000-10-26
2 -- Created by: Peter KURNEV
3 -- Copyright (c) 2000-2012 OPEN CASCADE SAS
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.
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.
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.
22 class EdgeEdge from IntTools
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.
30 Curve from BRepAdaptor,
31 SequenceOfRoots from IntTools,
32 SequenceOfRanges from IntTools,
33 CArray1OfReal from IntTools,
34 CommonPrt from IntTools,
35 SequenceOfCommonPrts from IntTools,
41 returns EdgeEdge from IntTools;
47 anEdge:Edge from TopoDS);
49 --- Sets the first edge
52 SetTolerance1 (me:out;
53 aTolEdge1:Real from Standard);
55 --- Sets the value of tolerance pipe for the first edge
59 anEdge:Edge from TopoDS);
61 --- Sets the second edge
64 SetTolerance2 (me:out;
65 aTolEdge2:Real from Standard);
67 --- Sets the value of tolerance pipe for the first edge
70 SetDiscretize (me:out;
71 aDiscret:Integer from Standard);
73 --- Sets the number of division for the shortest
74 --- edge among the two. The deflection is not taken
78 SetDeflection (me:out;
79 aDeflection:Real from Standard);
81 --- Sets the value of maximum reative deflection between
82 --- the two nearest points on a curve.
86 anEpsT:Real from Standard);
88 --- Sets the criteria of equality of two arguments,
89 --- i.e. |t2-t1|<anEpsT will mean that t2=t1
92 SetEpsilonNull (me:out;
93 anEpsNull:Real from Standard);
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)
100 aRange:Range from IntTools);
103 aRange:Range from IntTools);
106 aFirst, aLast:Real from Standard);
109 aFirst, aLast:Real from Standard);
113 --- The main method of the algorithm to determine
114 --- common parts between two edges in 3-d space
118 returns Boolean from Standard;
120 --- True if the common parts are found
124 returns Boolean from Standard;
126 --- False if the common parts are coherented with Edge1, Edge2
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
136 returns SequenceOfCommonPrts from IntTools;
137 ---C++: return const&
139 --- Returns the common parts (Output)
143 returns Range from IntTools;
144 ---C++: return const&
147 returns Range from IntTools;
148 ---C++: return const&
150 -----------------------------------------------------
151 -- Block of protected methods of the algorithm --
152 -----------------------------------------------------
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.
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.
174 t:Real from Standard)
175 returns Integer from Standard
178 --- Returns the flag 1 if it is possible to project
179 --- the point from the From-Curve at the parameter t
181 --- Othrwise it returns 0.
183 FindRangeOnCurve2 (me:out;
184 aCP:out CommonPrt from IntTools)
185 returns Integer from Standard
188 --- Find the range on the curve Curve-To that corresponds
189 --- to the given range on the curve Curve-From.
192 GetParameterOnCurve2 (me;
193 aT1:Real from Standard;
194 aT2:out Real from Standard)
195 returns Integer from Standard
198 --- Find the value of the parameter on the curve Curve-To
199 --- that corresponds to the given parameter on the curve
203 TreatVertexType(me:out;
204 am1, am2:Real from Standard;
205 aCP:out CommonPrt from IntTools)
206 returns Integer from Standard
209 IsIntersection (me:out;
210 t1 : Real from Standard;
211 t2 : Real from Standard)
215 FindDerivativeRoot (me:out;
216 t,f:CArray1OfReal from IntTools)
219 FindSimpleRoot (me:out;
220 IP:Integer from Standard;
221 ta, tb, fA:Real from Standard)
222 returns Real from Standard
225 --- Find the Root of the function on given interval
226 --- of the argument [ta,tb] using bisection method .
228 --- =1 - use DistanceFunction;
229 --- =2 - use DerivativeFunction;
232 DistanceFunction (me:out;
233 t:Real from Standard)
234 returns Real from Standard
237 --- Calculates the DistanceFunction D(t).
238 --- D(t)=D1(t) - myCriteria;
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.
246 DerivativeFunction (me:out;
247 t:Real from Standard)
248 returns Real from Standard
251 --- Calculates the first derivative of
252 --- the DistanceFunction D(t).
256 aCP: CommonPrt from IntTools;
257 t1 : out Real from Standard;
258 t2 : out Real from Standard)
259 returns Boolean from Standard
263 aCP: CommonPrt from IntTools;
264 t1 : out Real from Standard;
265 t2 : out Real from Standard)
266 returns Boolean from Standard
270 ComputeLineLine(me:out)
273 --modified by NIZNHY-PKV Mon Oct 31 12:16:55 2011f
275 returns Boolean from Standard
277 --modified by NIZNHY-PKV Mon Oct 31 12:16:59 2011t
281 myEdge1 : Edge from TopoDS;
282 myEdge2 : Edge from TopoDS;
283 myTol1 : Real from Standard;
284 myTol2 : Real from Standard;
286 myDiscret : Integer from Standard;
288 myEpsT : Real from Standard;
289 myEpsNull : Real from Standard;
290 myDeflection : Real from Standard;
293 myCFrom : Curve from BRepAdaptor;
294 myTminFrom : Real from Standard;
295 myTmaxFrom : Real from Standard;
296 myTolFrom : Real from Standard;
298 myCTo : Curve from BRepAdaptor;
299 myTminTo : Real from Standard;
300 myTmaxTo : Real from Standard;
301 myTolTo : Real from Standard;
303 myCriteria : Real from Standard;
305 myIsDone : Boolean from Standard;
306 myErrorStatus : Integer from Standard;
309 mySeqOfCommonPrts : SequenceOfCommonPrts from IntTools;
310 myOrder : Boolean from Standard; -- 0-strait; 1-reversed
311 myPar1 : Real from Standard;
312 myParallel : Boolean from Standard;
313 myRange1 : Range from IntTools;
314 myRange2 : Range from IntTools;