summaryrefslogtreecommitdiff
path: root/inc/IntTools_EdgeEdge.hxx
blob: 2d30fe44d5a78ee46567ae4569c4753916712607 (plain)
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
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _IntTools_EdgeEdge_HeaderFile
#define _IntTools_EdgeEdge_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _TopoDS_Edge_HeaderFile
#include <TopoDS_Edge.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _BRepAdaptor_Curve_HeaderFile
#include <BRepAdaptor_Curve.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _IntTools_SequenceOfRanges_HeaderFile
#include <IntTools_SequenceOfRanges.hxx>
#endif
#ifndef _IntTools_CArray1OfReal_HeaderFile
#include <IntTools_CArray1OfReal.hxx>
#endif
#ifndef _IntTools_SequenceOfRoots_HeaderFile
#include <IntTools_SequenceOfRoots.hxx>
#endif
#ifndef _IntTools_SequenceOfCommonPrts_HeaderFile
#include <IntTools_SequenceOfCommonPrts.hxx>
#endif
#ifndef _IntTools_Range_HeaderFile
#include <IntTools_Range.hxx>
#endif
class TopoDS_Edge;
class IntTools_Range;
class IntTools_SequenceOfCommonPrts;
class IntTools_CommonPrt;
class IntTools_CArray1OfReal;


//! The  class  provides  Edge/Edge  algorithm  to  determine <br>
//!          common  parts  between two edges in  3-d space. <br>
//!          Common  parts can be :  Vertices  or Edges. <br>
//! <br>
class IntTools_EdgeEdge  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  
//! Empty constructor <br>
  Standard_EXPORT   IntTools_EdgeEdge();
  
//! Sets the first edge <br>
  Standard_EXPORT     void SetEdge1(const TopoDS_Edge& anEdge) ;
  
//! Sets  the  value of tolerance pipe for the first edge <br>
  Standard_EXPORT     void SetTolerance1(const Standard_Real aTolEdge1) ;
  
//! Sets the second edge <br>
  Standard_EXPORT     void SetEdge2(const TopoDS_Edge& anEdge) ;
  
//! Sets  the  value of tolerance pipe for the first edge <br>
  Standard_EXPORT     void SetTolerance2(const Standard_Real aTolEdge2) ;
  
//! Sets  the  number of division for the shortest <br>
//! edge among the two.  The  deflection is not taken <br>
//! into  account <br>
  Standard_EXPORT     void SetDiscretize(const Standard_Integer aDiscret) ;
  
//! Sets the value of maximum reative deflection between <br>
//! the two nearest points on a curve. <br>
  Standard_EXPORT     void SetDeflection(const Standard_Real aDeflection) ;
  
//! Sets the criteria of equality of two arguments, <br>
//! i.e.  |t2-t1|<anEpsT will mean that t2=t1 <br>
  Standard_EXPORT     void SetEpsilonT(const Standard_Real anEpsT) ;
  
//! Sets the criteria of equality of two functions' values <br>
//! i.e.  |f(t2)-f(t1)|<anEpsNull will mean that f(t2)=f(t1) <br>
  Standard_EXPORT     void SetEpsilonNull(const Standard_Real anEpsNull) ;
  
  Standard_EXPORT     void SetRange1(const IntTools_Range& aRange) ;
  
  Standard_EXPORT     void SetRange2(const IntTools_Range& aRange) ;
  
  Standard_EXPORT     void SetRange1(const Standard_Real aFirst,const Standard_Real aLast) ;
  
  Standard_EXPORT     void SetRange2(const Standard_Real aFirst,const Standard_Real aLast) ;
  
//! The main method of the algorithm to determine <br>
//! common  parts  between two edges in  3-d space <br>
  Standard_EXPORT     void Perform() ;
  
//! True if the common  parts are found <br>
  Standard_EXPORT     Standard_Boolean IsDone() const;
  
//! False if the common parts are coherented  with Edge1, Edge2 <br>
  Standard_EXPORT     Standard_Boolean Order() const;
  //! Returns the number that corresponds to the error. <br>
//! The  list of error-codes is in  ...cxx file <br>
  Standard_EXPORT     Standard_Integer ErrorStatus() const;
  
//! Returns the common parts (Output) <br>
  Standard_EXPORT    const IntTools_SequenceOfCommonPrts& CommonParts() const;
  
  Standard_EXPORT    const IntTools_Range& Range1() const;
  
  Standard_EXPORT    const IntTools_Range& Range2() const;





protected:





private:

  
//! Fool-proof chechking the input data. <br>
//! The  following  data is not  available <br>
//!    *  Degenerated edges is  not  available; <br>
//!    *  Egdes,  that don't contain 3d-curve. <br>
  Standard_EXPORT     void CheckData() ;
  
//! Preparing the main  fields  for  the  algorithm <br>
//!    *  From-Curve  (myCFrom,myTminFrom,myTmaxFrom), <br>
//!    *  To  -Curve  (myCTo  ,myTminTo  ,myTmaxTo  ), <br>
//!    *  myCreiteria=myTol1+myTol2  , <br>
//!    *  myProjectableRanges. <br>
  Standard_EXPORT     void Prepare() ;
  
//! Returns the flag 1 if it is possible to project <br>
//! the point from the From-Curve at the  parameter t <br>
//! to the To-Curve. <br>
//! Othrwise it returns  0. <br>
  Standard_EXPORT     Standard_Integer IsProjectable(const Standard_Real t) const;
  
//! Find a bound of a projectable range for the From-Curve <br>
//! using  bisection  method. <br>
//! t1, t2  - interval for searching along t. <br>
//! f1, f2  - values of the function IsProjectable() <br>
//! at t1 and t2. <br>
  Standard_EXPORT     void FindProjectableRoot(const Standard_Real t1,const Standard_Real t2,const Standard_Integer f1,const Standard_Integer f2,Standard_Real& tRoot) ;
  
//! Calculates the DistanceFunction D(t). <br>
//! D(t)=D1(t) - myCriteria; <br>
//! where <br>
//! D1(t) -  the lower distance between a point from <br>
//! the  From-Curve at  parameter t  and <br>
//! projection point of  this point on To-Curve; <br>
//! myCriteria=myTol1+myTol2. <br>
  Standard_EXPORT     Standard_Real DistanceFunction(const Standard_Real t) ;
  
//! Calculates the first derivative of <br>
//! the DistanceFunction D(t). <br>
  Standard_EXPORT     Standard_Real DerivativeFunction(const Standard_Real t) ;
  
//! Find the Root of the function on given interval <br>
//! of the argument [ta,tb] using  bisection  method . <br>
//! IP  - a  flag; <br>
//! =1  -  use DistanceFunction; <br>
//! =2  -  use DerivativeFunction; <br>
  Standard_EXPORT     Standard_Real FindSimpleRoot(const Standard_Integer IP,const Standard_Real ta,const Standard_Real tb,const Standard_Real fA) ;
  
//! Find the Root of the function on given interval <br>
//! of the argument [ta,tb] using Fibonacci method . <br>
  Standard_EXPORT     Standard_Real FindGoldRoot(const Standard_Real ta,const Standard_Real tb,const Standard_Real coeff) ;
  
//! Find the range on the curve Curve-To that  corresponds <br>
//! to  the  given  range on the curve Curve-From. <br>
  Standard_EXPORT     Standard_Integer FindRangeOnCurve2(IntTools_CommonPrt& aCP) ;
  
//! Find the  value  of  the  parameter  on  the curve Curve-To <br>
//! that corresponds  to  the  given  parameter  on the curve <br>
//! Curve-From. <br>
  Standard_EXPORT     Standard_Integer GetParameterOnCurve2(const Standard_Real aT1,Standard_Real& aT2) const;
  
  Standard_EXPORT     Standard_Integer TreatVertexType(const Standard_Real am1,const Standard_Real am2,IntTools_CommonPrt& aCP) ;
  
  Standard_EXPORT     void IsIntersection(const Standard_Real t1,const Standard_Real t2) ;
  
  Standard_EXPORT     void FindDerivativeRoot(const IntTools_CArray1OfReal& t,const IntTools_CArray1OfReal& f) ;
  
  Standard_EXPORT     void RemoveIdenticalRoots() ;
  
  Standard_EXPORT     Standard_Boolean CheckTouch(const IntTools_CommonPrt& aCP,Standard_Real& t1,Standard_Real& t2) ;
  
  Standard_EXPORT     Standard_Boolean CheckTouchVertex(const IntTools_CommonPrt& aCP,Standard_Real& t1,Standard_Real& t2) const;
  
  Standard_EXPORT     Standard_Boolean CheckInterval(const Standard_Real t1,const Standard_Real t2) ;
  
  Standard_EXPORT     void ComputeLineLine() ;


TopoDS_Edge myEdge1;
TopoDS_Edge myEdge2;
Standard_Real myTol1;
Standard_Real myTol2;
Standard_Integer myDiscret;
Standard_Real myEpsT;
Standard_Real myEpsNull;
Standard_Real myDeflection;
BRepAdaptor_Curve myCFrom;
Standard_Real myTminFrom;
Standard_Real myTmaxFrom;
Standard_Real myTolFrom;
BRepAdaptor_Curve myCTo;
Standard_Real myTminTo;
Standard_Real myTmaxTo;
Standard_Real myTolTo;
Standard_Real myCriteria;
Standard_Boolean myIsDone;
Standard_Integer myErrorStatus;
IntTools_SequenceOfRanges myProjectableRanges;
IntTools_CArray1OfReal myFuncArray;
IntTools_CArray1OfReal myArgsArray;
IntTools_SequenceOfRoots mySequenceOfRoots;
IntTools_SequenceOfCommonPrts mySeqOfCommonPrts;
Standard_Boolean myOrder;
Standard_Real myPar1;
Standard_Boolean myParallel;
Standard_Boolean myAllNullFlag;
IntTools_Range myRange1;
IntTools_Range myRange2;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif