42cf5bc1 |
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 | |
c22b52d6 |
20 | #include <Adaptor3d_Curve.hxx> |
21 | #include <BRepAdaptor_Surface.hxx> |
42cf5bc1 |
22 | #include <IntCurveSurface_SequenceOfPnt.hxx> |
23 | #include <TColStd_SequenceOfInteger.hxx> |
42cf5bc1 |
24 | #include <TopoDS_Face.hxx> |
42cf5bc1 |
25 | #include <GeomAbs_SurfaceType.hxx> |
26 | #include <IntCurveSurface_TransitionOnCurve.hxx> |
27 | #include <TopAbs_State.hxx> |
c22b52d6 |
28 | |
42cf5bc1 |
29 | class BRepTopAdaptor_TopolTool; |
42cf5bc1 |
30 | class TopoDS_Face; |
31 | class gp_Lin; |
42cf5bc1 |
32 | class gp_Pnt; |
33 | class IntCurveSurface_HInter; |
34 | class gp_Pnt2d; |
35 | class Bnd_Box; |
36 | |
42cf5bc1 |
37 | class IntCurvesFace_Intersector |
38 | { |
39 | public: |
40 | |
41 | DEFINE_STANDARD_ALLOC |
42 | |
43 | |
44 | //! Load a Face. |
45 | //! |
46 | //! The Tolerance <Tol> is used to determine if the |
47 | //! first point of the segment is near the face. In |
48 | //! that case, the parameter of the intersection point |
49 | //! on the line can be a negative value (greater than -Tol). |
a0258acd |
50 | //! If aRestr = true UV bounding box of face is used to restrict |
51 | //! it's underlined surface, |
58e14d59 |
52 | //! otherwise surface is not restricted. |
53 | //! If UseBToler = false then the 2d-point of intersection is classified with null-tolerance |
54 | //! (relative to face); |
55 | //! otherwise it's using maximium between input tolerance(aTol) and tolerances of face bounds (edges). |
a0258acd |
56 | Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F, const Standard_Real aTol, |
58e14d59 |
57 | const Standard_Boolean aRestr = Standard_True, |
58 | const Standard_Boolean UseBToler = Standard_True); |
42cf5bc1 |
59 | |
60 | //! Perform the intersection between the |
61 | //! segment L and the loaded face. |
62 | //! |
63 | //! PInf is the smallest parameter on the line |
64 | //! PSup is the highest parmaeter on the line |
65 | //! |
66 | //! For an infinite line PInf and PSup can be |
67 | //! +/- RealLast. |
68 | Standard_EXPORT void Perform (const gp_Lin& L, const Standard_Real PInf, const Standard_Real PSup); |
69 | |
70 | //! same method for a HCurve from Adaptor3d. |
71 | //! PInf an PSup can also be - and + INF. |
c22b52d6 |
72 | Standard_EXPORT void Perform (const Handle(Adaptor3d_Curve)& HCu, const Standard_Real PInf, const Standard_Real PSup); |
42cf5bc1 |
73 | |
74 | //! Return the surface type |
75 | Standard_EXPORT GeomAbs_SurfaceType SurfaceType() const; |
76 | |
77 | //! True is returned when the intersection have been computed. |
78 | Standard_Boolean IsDone() const; |
79 | |
80 | Standard_Integer NbPnt() const; |
81 | |
82 | //! Returns the U parameter of the ith intersection point |
83 | //! on the surface. |
84 | Standard_Real UParameter (const Standard_Integer I) const; |
85 | |
86 | //! Returns the V parameter of the ith intersection point |
87 | //! on the surface. |
88 | Standard_Real VParameter (const Standard_Integer I) const; |
89 | |
90 | //! Returns the parameter of the ith intersection point |
91 | //! on the line. |
92 | Standard_Real WParameter (const Standard_Integer I) const; |
93 | |
94 | //! Returns the geometric point of the ith intersection |
95 | //! between the line and the surface. |
96 | const gp_Pnt& Pnt (const Standard_Integer I) const; |
97 | |
98 | //! Returns the ith transition of the line on the surface. |
99 | IntCurveSurface_TransitionOnCurve Transition (const Standard_Integer I) const; |
100 | |
101 | //! Returns the ith state of the point on the face. |
102 | //! The values can be either TopAbs_IN |
103 | //! ( the point is in the face) |
104 | //! or TopAbs_ON |
105 | //! ( the point is on a boudary of the face). |
106 | TopAbs_State State (const Standard_Integer I) const; |
f84edf58 |
107 | |
108 | //! Returns true if curve is parallel or belongs face surface |
109 | //! This case is recognized only for some pairs |
110 | //! of analytical curves and surfaces (plane - line, ...) |
111 | Standard_Boolean IsParallel() const; |
112 | |
42cf5bc1 |
113 | //! Returns the significant face used to determine |
114 | //! the intersection. |
115 | const TopoDS_Face& Face() const; |
116 | |
117 | Standard_EXPORT TopAbs_State ClassifyUVPoint (const gp_Pnt2d& Puv) const; |
118 | |
119 | Standard_EXPORT Bnd_Box Bounding() const; |
58e14d59 |
120 | |
121 | //! Sets the boundary tolerance flag |
122 | Standard_EXPORT void SetUseBoundToler(Standard_Boolean UseBToler ); |
123 | |
124 | //! Returns the boundary tolerance flag |
125 | Standard_EXPORT Standard_Boolean GetUseBoundToler() const; |
42cf5bc1 |
126 | |
127 | Standard_EXPORT void Destroy(); |
128 | ~IntCurvesFace_Intersector() |
129 | { |
130 | Destroy(); |
131 | } |
132 | |
133 | |
134 | |
135 | |
136 | protected: |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | private: |
143 | |
144 | |
145 | Standard_EXPORT void InternalCall (const IntCurveSurface_HInter& HICS, const Standard_Real pinf, const Standard_Real psup); |
146 | |
147 | |
148 | Handle(BRepTopAdaptor_TopolTool) myTopolTool; |
c22b52d6 |
149 | Handle(BRepAdaptor_Surface) Hsurface; |
42cf5bc1 |
150 | Standard_Real Tol; |
151 | IntCurveSurface_SequenceOfPnt SeqPnt; |
152 | TColStd_SequenceOfInteger mySeqState; |
153 | Standard_Boolean done; |
e8dec5e1 |
154 | Standard_Boolean myReady; |
42cf5bc1 |
155 | Standard_Integer nbpnt; |
156 | TopoDS_Face face; |
157 | Standard_Address PtrOnPolyhedron; |
158 | Standard_Address PtrOnBndBounding; |
58e14d59 |
159 | Standard_Boolean myUseBoundTol; |
f84edf58 |
160 | Standard_Boolean myIsParallel; //Curve is "parallel" face surface |
161 | //This case is recognized only for some pairs |
162 | //of analytical curves and surfaces (plane - line, ...) |
42cf5bc1 |
163 | |
164 | |
165 | }; |
166 | |
167 | |
168 | #include <IntCurvesFace_Intersector.lxx> |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | #endif // _IntCurvesFace_Intersector_HeaderFile |