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> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <BRepAdaptor_Curve.hxx> |
24 | #include <BRepAdaptor_Surface.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Extrema_ExtCS.hxx> |
27 | #include <GeomAPI_ProjectPointOnSurf.hxx> |
28 | #include <IntTools_MarkedRangeSet.hxx> |
29 | #include <IntTools_SequenceOfRanges.hxx> |
30 | #include <Standard_Boolean.hxx> |
31 | #include <Standard_Integer.hxx> |
32 | #include <IntTools_ListOfCurveRangeSample.hxx> |
33 | #include <IntTools_ListOfSurfaceRangeSample.hxx> |
34 | class Geom_Surface; |
35 | class IntTools_Context; |
36 | class TopoDS_Edge; |
37 | class TopoDS_Face; |
38 | class BRepAdaptor_Curve; |
39 | class BRepAdaptor_Surface; |
40 | class IntTools_CurveRangeSample; |
41 | class Bnd_Box; |
42 | class IntTools_SurfaceRangeSample; |
43 | class IntTools_CurveRangeLocalizeData; |
44 | class IntTools_SurfaceRangeLocalizeData; |
45 | |
46 | |
47 | //! The class BeanFaceIntersector computes ranges of parameters on |
48 | //! the curve of a bean(part of edge) that bound the parts of bean which |
49 | //! are on the surface of a face according to edge and face tolerances. |
50 | //! Warning: The real boundaries of the face are not taken into account, |
51 | //! Most of the result parts of the bean lays only inside the region of the surface, |
52 | //! which includes the inside of the face. And the parts which are out of this region can be |
53 | //! excluded from the result. |
54 | class IntTools_BeanFaceIntersector |
55 | { |
56 | public: |
57 | |
58 | DEFINE_STANDARD_ALLOC |
59 | |
60 | |
61 | Standard_EXPORT IntTools_BeanFaceIntersector(); |
62 | |
63 | |
64 | //! Initializes the algorithm |
65 | //! |
66 | //! Warning: |
67 | //! The parts of the edge which are on |
68 | //! the surface of the face and belong to |
69 | //! the whole in the face (if there is) |
70 | //! is considered as result |
71 | Standard_EXPORT IntTools_BeanFaceIntersector(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace); |
72 | |
73 | |
74 | //! Initializes the algorithm |
75 | Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance); |
76 | |
77 | |
78 | //! Initializes the algorithm |
79 | //! theUMinParameter, ... are used for |
80 | //! optimization purposes |
81 | 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); |
82 | |
83 | |
84 | //! Initializes the algorithm |
85 | //! |
86 | //! Warning: |
87 | //! The parts of the edge which are on |
88 | //! the surface of the face and belong to |
89 | //! the whole in the face (if there is) |
90 | //! is considered as result |
91 | Standard_EXPORT void Init (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace); |
92 | |
93 | |
94 | //! Initializes the algorithm |
95 | Standard_EXPORT void Init (const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance); |
96 | |
97 | |
98 | //! Initializes the algorithm |
99 | //! theUMinParameter, ... are used for |
100 | //! optimization purposes |
101 | 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); |
102 | |
103 | |
104 | //! Sets the intersecton context |
105 | Standard_EXPORT void SetContext (const Handle(IntTools_Context)& theContext); |
106 | |
107 | |
108 | //! Gets the intersecton context |
109 | Standard_EXPORT const Handle(IntTools_Context)& Context() const; |
110 | |
111 | |
112 | //! Set restrictions for curve |
113 | Standard_EXPORT void SetBeanParameters (const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve); |
114 | |
115 | |
116 | //! Set restrictions for surface |
117 | Standard_EXPORT void SetSurfaceParameters (const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter); |
118 | |
119 | |
120 | //! Launches the algorithm |
121 | Standard_EXPORT void Perform(); |
122 | |
123 | Standard_Boolean IsDone() const; |
124 | |
125 | Standard_EXPORT const IntTools_SequenceOfRanges& Result() const; |
126 | |
127 | Standard_EXPORT void Result (IntTools_SequenceOfRanges& theResults) const; |
128 | |
129 | |
130 | |
131 | |
132 | protected: |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | private: |
139 | |
140 | |
141 | Standard_EXPORT void ComputeAroundExactIntersection(); |
142 | |
143 | Standard_EXPORT void ComputeLinePlane(); |
144 | |
145 | Standard_EXPORT Standard_Integer FastComputeExactIntersection(); |
146 | |
147 | Standard_EXPORT void ComputeUsingExtremum(); |
148 | |
149 | Standard_EXPORT void ComputeNearRangeBoundaries(); |
150 | |
151 | Standard_EXPORT Standard_Boolean ComputeLocalized(); |
152 | |
153 | Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter); |
154 | |
155 | Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter, const Standard_Integer theIndex); |
156 | |
157 | Standard_EXPORT Standard_Real Distance (const Standard_Real theArg, Standard_Real& theUParameter, Standard_Real& theVParameter); |
158 | |
159 | Standard_EXPORT Standard_Real Distance (const Standard_Real theArg); |
160 | |
161 | 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); |
162 | |
163 | Standard_EXPORT Standard_Boolean TestComputeCoinside(); |
164 | |
165 | |
166 | BRepAdaptor_Curve myCurve; |
167 | BRepAdaptor_Surface mySurface; |
168 | Handle(Geom_Surface) myTrsfSurface; |
169 | Standard_Real myFirstParameter; |
170 | Standard_Real myLastParameter; |
171 | Standard_Real myUMinParameter; |
172 | Standard_Real myUMaxParameter; |
173 | Standard_Real myVMinParameter; |
174 | Standard_Real myVMaxParameter; |
175 | Standard_Real myBeanTolerance; |
176 | Standard_Real myFaceTolerance; |
177 | Standard_Real myCurveResolution; |
178 | Standard_Real myCriteria; |
179 | Extrema_ExtCS myExtrema; |
180 | GeomAPI_ProjectPointOnSurf myProjector; |
181 | IntTools_MarkedRangeSet myRangeManager; |
182 | Standard_Real myDeflection; |
183 | Handle(IntTools_Context) myContext; |
184 | IntTools_SequenceOfRanges myResults; |
185 | Standard_Boolean myIsDone; |
186 | |
187 | |
188 | }; |
189 | |
190 | |
191 | #include <IntTools_BeanFaceIntersector.lxx> |
192 | |
193 | |
194 | |
195 | |
196 | |
197 | #endif // _IntTools_BeanFaceIntersector_HeaderFile |