42cf5bc1 |
1 | // Created on: 2001-06-29 |
2 | // Created by: Michael KLOKOV |
3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _IntTools_BeanFaceIntersector_HeaderFile |
17 | #define _IntTools_BeanFaceIntersector_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
42cf5bc1 |
21 | |
22 | #include <BRepAdaptor_Curve.hxx> |
23 | #include <BRepAdaptor_Surface.hxx> |
24 | #include <Standard_Real.hxx> |
25 | #include <Extrema_ExtCS.hxx> |
26 | #include <GeomAPI_ProjectPointOnSurf.hxx> |
27 | #include <IntTools_MarkedRangeSet.hxx> |
28 | #include <IntTools_SequenceOfRanges.hxx> |
29 | #include <Standard_Boolean.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | #include <IntTools_ListOfCurveRangeSample.hxx> |
32 | #include <IntTools_ListOfSurfaceRangeSample.hxx> |
33 | class Geom_Surface; |
34 | class IntTools_Context; |
35 | class TopoDS_Edge; |
36 | class TopoDS_Face; |
42cf5bc1 |
37 | class IntTools_CurveRangeSample; |
38 | class Bnd_Box; |
39 | class IntTools_SurfaceRangeSample; |
40 | class IntTools_CurveRangeLocalizeData; |
41 | class IntTools_SurfaceRangeLocalizeData; |
42 | |
43 | |
44 | //! The class BeanFaceIntersector computes ranges of parameters on |
45 | //! the curve of a bean(part of edge) that bound the parts of bean which |
46 | //! are on the surface of a face according to edge and face tolerances. |
47 | //! Warning: The real boundaries of the face are not taken into account, |
48 | //! Most of the result parts of the bean lays only inside the region of the surface, |
49 | //! which includes the inside of the face. And the parts which are out of this region can be |
50 | //! excluded from the result. |
51 | class IntTools_BeanFaceIntersector |
52 | { |
53 | public: |
54 | |
55 | DEFINE_STANDARD_ALLOC |
56 | |
57 | |
58 | Standard_EXPORT IntTools_BeanFaceIntersector(); |
59 | |
60 | |
61 | //! Initializes the algorithm |
62 | //! |
63 | //! Warning: |
64 | //! The parts of the edge which are on |
65 | //! the surface of the face and belong to |
66 | //! the whole in the face (if there is) |
67 | //! is considered as result |
68 | Standard_EXPORT IntTools_BeanFaceIntersector(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace); |
69 | |
70 | |
71 | //! Initializes the algorithm |
72 | Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance); |
73 | |
74 | |
75 | //! Initializes the algorithm |
76 | //! theUMinParameter, ... are used for |
77 | //! optimization purposes |
78 | Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve, const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance); |
79 | |
80 | |
81 | //! Initializes the algorithm |
82 | //! |
83 | //! Warning: |
84 | //! The parts of the edge which are on |
85 | //! the surface of the face and belong to |
86 | //! the whole in the face (if there is) |
87 | //! is considered as result |
88 | Standard_EXPORT void Init (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace); |
89 | |
90 | |
91 | //! Initializes the algorithm |
92 | Standard_EXPORT void Init (const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance); |
93 | |
94 | |
95 | //! Initializes the algorithm |
96 | //! theUMinParameter, ... are used for |
97 | //! optimization purposes |
98 | Standard_EXPORT void Init (const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve, const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance); |
99 | |
100 | |
0177fe26 |
101 | //! Sets the intersection context |
42cf5bc1 |
102 | Standard_EXPORT void SetContext (const Handle(IntTools_Context)& theContext); |
103 | |
104 | |
0177fe26 |
105 | //! Gets the intersection context |
42cf5bc1 |
106 | Standard_EXPORT const Handle(IntTools_Context)& Context() const; |
107 | |
108 | |
109 | //! Set restrictions for curve |
110 | Standard_EXPORT void SetBeanParameters (const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve); |
111 | |
112 | |
113 | //! Set restrictions for surface |
114 | Standard_EXPORT void SetSurfaceParameters (const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter); |
115 | |
116 | |
117 | //! Launches the algorithm |
118 | Standard_EXPORT void Perform(); |
119 | |
03cca6f7 |
120 | //! Returns Done/NotDone state of the algorithm. |
121 | Standard_Boolean IsDone() const |
122 | { |
123 | return myIsDone; |
124 | } |
42cf5bc1 |
125 | |
126 | Standard_EXPORT const IntTools_SequenceOfRanges& Result() const; |
127 | |
128 | Standard_EXPORT void Result (IntTools_SequenceOfRanges& theResults) const; |
129 | |
cd0705f6 |
130 | //! Returns the minimal distance found between edge and face |
131 | Standard_Real MinimalSquareDistance() const |
132 | { |
133 | return myMinSqDistance; |
134 | } |
42cf5bc1 |
135 | |
136 | |
137 | private: |
42cf5bc1 |
138 | |
139 | Standard_EXPORT void ComputeAroundExactIntersection(); |
140 | |
141 | Standard_EXPORT void ComputeLinePlane(); |
142 | |
03cca6f7 |
143 | //! Fast check on coincidence of the edge with face for the cases when both shapes are |
144 | //! based on analytic geometries. The method also computes if the intersection |
145 | //! between shapes is possible. |
146 | //! The method returns TRUE if the computation was successful and further computation is unnecessary. |
147 | //! Otherwise it returns FALSE and computation continues. |
148 | Standard_EXPORT Standard_Boolean FastComputeAnalytic(); |
42cf5bc1 |
149 | |
150 | Standard_EXPORT void ComputeUsingExtremum(); |
151 | |
152 | Standard_EXPORT void ComputeNearRangeBoundaries(); |
153 | |
154 | Standard_EXPORT Standard_Boolean ComputeLocalized(); |
155 | |
156 | Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter); |
157 | |
158 | Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter, const Standard_Integer theIndex); |
159 | |
160 | Standard_EXPORT Standard_Real Distance (const Standard_Real theArg, Standard_Real& theUParameter, Standard_Real& theVParameter); |
161 | |
162 | Standard_EXPORT Standard_Real Distance (const Standard_Real theArg); |
163 | |
164 | Standard_EXPORT Standard_Boolean LocalizeSolutions (const IntTools_CurveRangeSample& theCurveRange, const Bnd_Box& theBoxCurve, const IntTools_SurfaceRangeSample& theSurfaceRange, const Bnd_Box& theBoxSurface, IntTools_CurveRangeLocalizeData& theCurveData, IntTools_SurfaceRangeLocalizeData& theSurfaceData, IntTools_ListOfCurveRangeSample& theListCurveRange, IntTools_ListOfSurfaceRangeSample& theListSurfaceRange); |
165 | |
166 | Standard_EXPORT Standard_Boolean TestComputeCoinside(); |
167 | |
168 | |
169 | BRepAdaptor_Curve myCurve; |
170 | BRepAdaptor_Surface mySurface; |
171 | Handle(Geom_Surface) myTrsfSurface; |
172 | Standard_Real myFirstParameter; |
173 | Standard_Real myLastParameter; |
174 | Standard_Real myUMinParameter; |
175 | Standard_Real myUMaxParameter; |
176 | Standard_Real myVMinParameter; |
177 | Standard_Real myVMaxParameter; |
178 | Standard_Real myBeanTolerance; |
179 | Standard_Real myFaceTolerance; |
180 | Standard_Real myCurveResolution; |
181 | Standard_Real myCriteria; |
42cf5bc1 |
182 | GeomAPI_ProjectPointOnSurf myProjector; |
183 | IntTools_MarkedRangeSet myRangeManager; |
42cf5bc1 |
184 | Handle(IntTools_Context) myContext; |
185 | IntTools_SequenceOfRanges myResults; |
186 | Standard_Boolean myIsDone; |
cd0705f6 |
187 | Standard_Real myMinSqDistance; |
42cf5bc1 |
188 | |
42cf5bc1 |
189 | }; |
190 | |
42cf5bc1 |
191 | #endif // _IntTools_BeanFaceIntersector_HeaderFile |