1 // Created on: 2001-06-29
2 // Created by: Michael KLOKOV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IntTools_BeanFaceIntersector_HeaderFile
17 #define _IntTools_BeanFaceIntersector_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
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>
35 class IntTools_Context;
38 class BRepAdaptor_Curve;
39 class BRepAdaptor_Surface;
40 class IntTools_CurveRangeSample;
42 class IntTools_SurfaceRangeSample;
43 class IntTools_CurveRangeLocalizeData;
44 class IntTools_SurfaceRangeLocalizeData;
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
61 Standard_EXPORT IntTools_BeanFaceIntersector();
64 //! Initializes the algorithm
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);
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);
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);
84 //! Initializes the algorithm
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);
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);
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);
104 //! Sets the intersecton context
105 Standard_EXPORT void SetContext (const Handle(IntTools_Context)& theContext);
108 //! Gets the intersecton context
109 Standard_EXPORT const Handle(IntTools_Context)& Context() const;
112 //! Set restrictions for curve
113 Standard_EXPORT void SetBeanParameters (const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve);
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);
120 //! Launches the algorithm
121 Standard_EXPORT void Perform();
123 Standard_Boolean IsDone() const;
125 Standard_EXPORT const IntTools_SequenceOfRanges& Result() const;
127 Standard_EXPORT void Result (IntTools_SequenceOfRanges& theResults) const;
141 Standard_EXPORT void ComputeAroundExactIntersection();
143 Standard_EXPORT void ComputeLinePlane();
145 Standard_EXPORT Standard_Integer FastComputeExactIntersection();
147 Standard_EXPORT void ComputeUsingExtremum();
149 Standard_EXPORT void ComputeNearRangeBoundaries();
151 Standard_EXPORT Standard_Boolean ComputeLocalized();
153 Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter);
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);
157 Standard_EXPORT Standard_Real Distance (const Standard_Real theArg, Standard_Real& theUParameter, Standard_Real& theVParameter);
159 Standard_EXPORT Standard_Real Distance (const Standard_Real theArg);
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);
163 Standard_EXPORT Standard_Boolean TestComputeCoinside();
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;
191 #include <IntTools_BeanFaceIntersector.lxx>
197 #endif // _IntTools_BeanFaceIntersector_HeaderFile