0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IntTools / IntTools_EdgeEdge.hxx
CommitLineData
42cf5bc1 1// Created by: Eugeny MALTCHIKOV
2// Copyright (c) 2013-2014 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _IntTools_EdgeEdge_HeaderFile
16#define _IntTools_EdgeEdge_HeaderFile
17
18#include <Standard.hxx>
19#include <Standard_DefineAlloc.hxx>
20#include <Standard_Handle.hxx>
21
42cf5bc1 22#include <BRepAdaptor_Curve.hxx>
42cf5bc1 23#include <Standard_Integer.hxx>
24#include <IntTools_SequenceOfCommonPrts.hxx>
25#include <IntTools_SequenceOfRanges.hxx>
26#include <TopAbs_ShapeEnum.hxx>
27class Geom_Curve;
42cf5bc1 28class Bnd_Box;
42cf5bc1 29
30
31
32//! The class provides Edge/Edge intersection algorithm
33//! based on the intersection between edges bounding boxes.
34class IntTools_EdgeEdge
35{
36public:
37
38 DEFINE_STANDARD_ALLOC
39
40
41
0177fe26 42 //! Empty constructor
3510db62 43 IntTools_EdgeEdge();
44
45 //! Destructor
46 ~IntTools_EdgeEdge();
42cf5bc1 47
0177fe26 48 //! Constructor
3510db62 49 IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
42cf5bc1 50
51
0177fe26 52 //! Constructor
3510db62 53 IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const Standard_Real aT11,
54 const Standard_Real aT12, const TopoDS_Edge& theEdge2,
55 const Standard_Real aT21, const Standard_Real aT22);
42cf5bc1 56
57
58 //! Sets the first edge
3510db62 59 void SetEdge1(const TopoDS_Edge& theEdge);
42cf5bc1 60
61
62 //! Sets the first edge and its range
3510db62 63 void SetEdge1(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
42cf5bc1 64
65
66 //! Sets the range for the first edge
3510db62 67 void SetRange1(const IntTools_Range& theRange1);
42cf5bc1 68
69
70 //! Sets the range for the first edge
3510db62 71 void SetRange1(const Standard_Real aT1, const Standard_Real aT2);
42cf5bc1 72
73
74 //! Sets the second edge
3510db62 75 void SetEdge2(const TopoDS_Edge& theEdge);
42cf5bc1 76
77
78 //! Sets the first edge and its range
3510db62 79 void SetEdge2(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
42cf5bc1 80
81
82 //! Sets the range for the second edge
3510db62 83 void SetRange2(const IntTools_Range& theRange);
42cf5bc1 84
85
86 //! Sets the range for the second edge
3510db62 87 void SetRange2(const Standard_Real aT1, const Standard_Real aT2);
42cf5bc1 88
89
0d0481c7 90 //! Sets the Fuzzy value
91 void SetFuzzyValue (const Standard_Real theFuzz);
92
93
42cf5bc1 94 //! Performs the intersection between edges
95 Standard_EXPORT void Perform();
96
97
98 //! Returns TRUE if common part(s) is(are) found
3510db62 99 Standard_Boolean IsDone() const;
42cf5bc1 100
101
0d0481c7 102 //! Returns Fuzzy value
103 Standard_Real FuzzyValue() const;
104
105
42cf5bc1 106 //! Returns common parts
3510db62 107 const IntTools_SequenceOfCommonPrts& CommonParts() const;
42cf5bc1 108
109
6dc83e21 110 //! Sets the flag myQuickCoincidenceCheck
111 void UseQuickCoincidenceCheck (const Standard_Boolean bFlag) {
112 myQuickCoincidenceCheck=bFlag;
113 }
42cf5bc1 114
6dc83e21 115 //! Returns the flag myQuickCoincidenceCheck
116 Standard_Boolean IsCoincidenceCheckedQuickly () {
117 return myQuickCoincidenceCheck;
118 }
42cf5bc1 119
120protected:
121
122
123
124 //! Checks the data
3510db62 125 void CheckData();
42cf5bc1 126
127
128 //! Prepares the data
129 Standard_EXPORT void Prepare();
130
131
132 //! Computes Line/Line intersection.
133 Standard_EXPORT void ComputeLineLine();
134
135
136 //! Intermediate function
3510db62 137 Standard_EXPORT void FindSolutions (IntTools_SequenceOfRanges& theRanges1,
138 IntTools_SequenceOfRanges& theRanges2, Standard_Boolean& bSplit2);
42cf5bc1 139
140
141 //! Looking for the exact intersection ranges
88c3accd 142 Standard_EXPORT void FindSolutions (
143 const IntTools_Range& theR1, const Bnd_Box& theBox1,
3510db62 144 const IntTools_Range& theR2, const Bnd_Box& theBox2,
145 IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2);
42cf5bc1 146
147
148 //! Merges found solutions
3510db62 149 Standard_EXPORT void MergeSolutions (const IntTools_SequenceOfRanges& theRanges1,
150 const IntTools_SequenceOfRanges& theRanges2, const Standard_Boolean bSplit2);
42cf5bc1 151
152
28c08a7d 153 //! Looking for the range of the edge which is in the box
3510db62 154 Standard_EXPORT static Standard_Boolean FindParameters(const BRepAdaptor_Curve& theBAC,
155 const Standard_Real aT1, const Standard_Real aT2, const Standard_Real theTol,
156 const Standard_Real theRes, const Standard_Real thePTol,
157 const Standard_Real theResCoeff, const Bnd_Box& theCBox,
158 Standard_Real& aTB1, Standard_Real& aTB2);
42cf5bc1 159
160
161 //! Checks if edges coincide on the ranges
3510db62 162 Standard_EXPORT Standard_Integer CheckCoincidence (const Standard_Real aT11,
163 const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22,
164 const Standard_Real theCriteria, const Standard_Real theCurveRes1);
42cf5bc1 165
166
167 //! Adds common part of the given type to myCommonParts
3510db62 168 Standard_EXPORT void AddSolution (const Standard_Real aT11, const Standard_Real aT12,
169 const Standard_Real aT21, const Standard_Real aT22, const TopAbs_ShapeEnum theType);
42cf5bc1 170
171
172 //! Looking for the minimal distance between edges on the ranges
3510db62 173 Standard_EXPORT void FindBestSolution (const Standard_Real aT11, const Standard_Real aT12,
174 const Standard_Real aT21, const Standard_Real aT22,
175 Standard_Real& aT1, Standard_Real& aT2);
42cf5bc1 176
177
178 //! Checks is there an intersection between edges on the given ranges
179 //! (for nearly conicident edges)
3510db62 180 Standard_EXPORT Standard_Boolean IsIntersection (const Standard_Real aT11,
181 const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22);
42cf5bc1 182
6dc83e21 183 //! Checks if the edges are coincident really.
184 Standard_EXPORT Standard_Boolean IsCoincident();
42cf5bc1 185
186 TopoDS_Edge myEdge1;
187 TopoDS_Edge myEdge2;
188 Handle(Geom_Curve) myGeom1;
189 Handle(Geom_Curve) myGeom2;
190 BRepAdaptor_Curve myCurve1;
191 BRepAdaptor_Curve myCurve2;
192 Standard_Real myTol1;
193 Standard_Real myTol2;
194 Standard_Real myTol;
0d0481c7 195 Standard_Real myFuzzyValue;
42cf5bc1 196 Standard_Real myRes1;
197 Standard_Real myRes2;
198 Standard_Real myResCoeff1;
199 Standard_Real myResCoeff2;
200 Standard_Real myPTol1;
201 Standard_Real myPTol2;
202 IntTools_Range myRange1;
203 IntTools_Range myRange2;
204 Standard_Boolean mySwap;
205 Standard_Integer myErrorStatus;
206 IntTools_SequenceOfCommonPrts myCommonParts;
207
6dc83e21 208 //! Allows avoiding use Edge-Edge intersection
209 //! algorithm (i.e. speeding up the Boolean algorithm)
210 //! if the edges are coincided really.
211 //! If it is not evidently set of this flag should
212 //! be avoided (otherwise, the performance of
213 //! Boolean algorithm will be slower).
214 Standard_Boolean myQuickCoincidenceCheck;
215
42cf5bc1 216private:
217
42cf5bc1 218};
219
42cf5bc1 220#include <IntTools_EdgeEdge.lxx>
221
42cf5bc1 222#endif // _IntTools_EdgeEdge_HeaderFile