0028599: Replacement of old Boolean operations with new ones in BRepProj_Projection...
[occt.git] / src / IntTools / IntTools_BeanFaceIntersector.hxx
CommitLineData
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>
34class Geom_Surface;
35class IntTools_Context;
36class TopoDS_Edge;
37class TopoDS_Face;
38class BRepAdaptor_Curve;
39class BRepAdaptor_Surface;
40class IntTools_CurveRangeSample;
41class Bnd_Box;
42class IntTools_SurfaceRangeSample;
43class IntTools_CurveRangeLocalizeData;
44class 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.
54class IntTools_BeanFaceIntersector
55{
56public:
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
03cca6f7 123 //! Returns Done/NotDone state of the algorithm.
124 Standard_Boolean IsDone() const
125 {
126 return myIsDone;
127 }
42cf5bc1 128
129 Standard_EXPORT const IntTools_SequenceOfRanges& Result() const;
130
131 Standard_EXPORT void Result (IntTools_SequenceOfRanges& theResults) const;
132
133
134
135
136protected:
137
138
139
140
141
142private:
143
144
145 Standard_EXPORT void ComputeAroundExactIntersection();
146
147 Standard_EXPORT void ComputeLinePlane();
148
03cca6f7 149 //! Fast check on coincidence of the edge with face for the cases when both shapes are
150 //! based on analytic geometries. The method also computes if the intersection
151 //! between shapes is possible.
152 //! The method returns TRUE if the computation was successful and further computation is unnecessary.
153 //! Otherwise it returns FALSE and computation continues.
154 Standard_EXPORT Standard_Boolean FastComputeAnalytic();
42cf5bc1 155
156 Standard_EXPORT void ComputeUsingExtremum();
157
158 Standard_EXPORT void ComputeNearRangeBoundaries();
159
160 Standard_EXPORT Standard_Boolean ComputeLocalized();
161
162 Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter);
163
164 Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter, const Standard_Integer theIndex);
165
166 Standard_EXPORT Standard_Real Distance (const Standard_Real theArg, Standard_Real& theUParameter, Standard_Real& theVParameter);
167
168 Standard_EXPORT Standard_Real Distance (const Standard_Real theArg);
169
170 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);
171
172 Standard_EXPORT Standard_Boolean TestComputeCoinside();
173
174
175 BRepAdaptor_Curve myCurve;
176 BRepAdaptor_Surface mySurface;
177 Handle(Geom_Surface) myTrsfSurface;
178 Standard_Real myFirstParameter;
179 Standard_Real myLastParameter;
180 Standard_Real myUMinParameter;
181 Standard_Real myUMaxParameter;
182 Standard_Real myVMinParameter;
183 Standard_Real myVMaxParameter;
184 Standard_Real myBeanTolerance;
185 Standard_Real myFaceTolerance;
186 Standard_Real myCurveResolution;
187 Standard_Real myCriteria;
188 Extrema_ExtCS myExtrema;
189 GeomAPI_ProjectPointOnSurf myProjector;
190 IntTools_MarkedRangeSet myRangeManager;
42cf5bc1 191 Handle(IntTools_Context) myContext;
192 IntTools_SequenceOfRanges myResults;
193 Standard_Boolean myIsDone;
194
42cf5bc1 195};
196
42cf5bc1 197#endif // _IntTools_BeanFaceIntersector_HeaderFile