0027117: BRepClass3d_SolidClassifier doesn't take into account vertex/edge/face toler...
[occt.git] / src / IntCurvesFace / IntCurvesFace_Intersector.hxx
1 // Created on: 1996-05-31
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _IntCurvesFace_Intersector_HeaderFile
18 #define _IntCurvesFace_Intersector_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <IntCurveSurface_SequenceOfPnt.hxx>
26 #include <TColStd_SequenceOfInteger.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Integer.hxx>
29 #include <TopoDS_Face.hxx>
30 #include <Standard_Address.hxx>
31 #include <GeomAbs_SurfaceType.hxx>
32 #include <IntCurveSurface_TransitionOnCurve.hxx>
33 #include <TopAbs_State.hxx>
34 class BRepTopAdaptor_TopolTool;
35 class BRepAdaptor_HSurface;
36 class TopoDS_Face;
37 class gp_Lin;
38 class Adaptor3d_HCurve;
39 class gp_Pnt;
40 class IntCurveSurface_HInter;
41 class gp_Pnt2d;
42 class Bnd_Box;
43
44
45
46 class IntCurvesFace_Intersector 
47 {
48 public:
49
50   DEFINE_STANDARD_ALLOC
51
52   
53   //! Load a Face.
54   //!
55   //! The Tolerance <Tol> is used to determine if the
56   //! first point of the segment is near the face. In
57   //! that case, the parameter of the intersection point
58   //! on the line can be a negative value (greater than -Tol).
59   //! If aRestr = true UV bounding box of face is used to restrict 
60   //! it's underlined surface,
61   //! otherwise surface is not restricted.
62   //! If UseBToler = false then the 2d-point of intersection is classified with null-tolerance
63   //! (relative to face);
64   //! otherwise it's using maximium between input tolerance(aTol) and tolerances of face bounds (edges).
65   Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F, const Standard_Real aTol, 
66                                             const Standard_Boolean aRestr = Standard_True,
67                                             const Standard_Boolean UseBToler = Standard_True);
68   
69   //! Perform the intersection between the
70   //! segment L and the loaded face.
71   //!
72   //! PInf is the smallest parameter on the line
73   //! PSup is the highest  parmaeter on the line
74   //!
75   //! For an infinite line PInf and PSup can be
76   //! +/- RealLast.
77   Standard_EXPORT void Perform (const gp_Lin& L, const Standard_Real PInf, const Standard_Real PSup);
78   
79   //! same method for a HCurve from Adaptor3d.
80   //! PInf an PSup can also be - and + INF.
81   Standard_EXPORT void Perform (const Handle(Adaptor3d_HCurve)& HCu, const Standard_Real PInf, const Standard_Real PSup);
82   
83   //! Return the surface type
84   Standard_EXPORT GeomAbs_SurfaceType SurfaceType() const;
85   
86   //! True is returned when the intersection have been computed.
87     Standard_Boolean IsDone() const;
88   
89     Standard_Integer NbPnt() const;
90   
91   //! Returns the U parameter of the ith intersection point
92   //! on the surface.
93     Standard_Real UParameter (const Standard_Integer I) const;
94   
95   //! Returns the V parameter of the ith intersection point
96   //! on the surface.
97     Standard_Real VParameter (const Standard_Integer I) const;
98   
99   //! Returns the parameter of the ith intersection point
100   //! on the line.
101     Standard_Real WParameter (const Standard_Integer I) const;
102   
103   //! Returns the geometric point of the ith intersection
104   //! between the line and the surface.
105     const gp_Pnt& Pnt (const Standard_Integer I) const;
106   
107   //! Returns the ith transition of the line on the surface.
108     IntCurveSurface_TransitionOnCurve Transition (const Standard_Integer I) const;
109   
110   //! Returns the ith state of the point on the face.
111   //! The values can be either TopAbs_IN
112   //! ( the point is in the face)
113   //! or TopAbs_ON
114   //! ( the point is on a boudary of the face).
115     TopAbs_State State (const Standard_Integer I) const;
116   
117   //! Returns the significant face used to determine
118   //! the intersection.
119     const TopoDS_Face& Face() const;
120   
121   Standard_EXPORT TopAbs_State ClassifyUVPoint (const gp_Pnt2d& Puv) const;
122   
123   Standard_EXPORT Bnd_Box Bounding() const;
124
125   //! Sets the boundary tolerance flag
126   Standard_EXPORT void SetUseBoundToler(Standard_Boolean UseBToler );
127
128   //! Returns the boundary tolerance flag
129   Standard_EXPORT Standard_Boolean GetUseBoundToler() const;
130   
131   Standard_EXPORT void Destroy();
132 ~IntCurvesFace_Intersector()
133 {
134   Destroy();
135 }
136
137
138
139
140 protected:
141
142
143
144
145
146 private:
147
148   
149   Standard_EXPORT void InternalCall (const IntCurveSurface_HInter& HICS, const Standard_Real pinf, const Standard_Real psup);
150
151
152   Handle(BRepTopAdaptor_TopolTool) myTopolTool;
153   Handle(BRepAdaptor_HSurface) Hsurface;
154   Standard_Real Tol;
155   IntCurveSurface_SequenceOfPnt SeqPnt;
156   TColStd_SequenceOfInteger mySeqState;
157   Standard_Boolean done;
158   Standard_Integer nbpnt;
159   TopoDS_Face face;
160   Standard_Address PtrOnPolyhedron;
161   Standard_Address PtrOnBndBounding;
162   Standard_Boolean myUseBoundTol;
163
164
165 };
166
167
168 #include <IntCurvesFace_Intersector.lxx>
169
170
171
172
173
174 #endif // _IntCurvesFace_Intersector_HeaderFile