42cf5bc1 |
1 | // Created on: 1994-02-07 |
2 | // Created by: Modelistation |
3 | // Copyright (c) 1994-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 _BRepIntCurveSurface_Inter_HeaderFile |
18 | #define _BRepIntCurveSurface_Inter_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_HInter.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <TopAbs_State.hxx> |
28 | #include <Bnd_Box.hxx> |
29 | #include <TopTools_SequenceOfShape.hxx> |
30 | #include <Bnd_HArray1OfBox.hxx> |
31 | #include <Standard_Boolean.hxx> |
32 | #include <IntCurveSurface_TransitionOnCurve.hxx> |
33 | class GeomAdaptor_HCurve; |
34 | class BRepTopAdaptor_TopolTool; |
35 | class StdFail_NotDone; |
36 | class TopoDS_Shape; |
37 | class GeomAdaptor_Curve; |
38 | class gp_Lin; |
39 | class IntCurveSurface_IntersectionPoint; |
40 | class gp_Pnt; |
41 | class TopoDS_Face; |
42 | |
43 | |
44 | //! Computes the intersection between a face and a |
45 | //! curve. To intersect one curve with shape method |
46 | //! Init(Shape, curve, tTol) should be used. To |
47 | //! intersect a few curves with specified shape it is |
48 | //! necessary to load shape one time using method |
49 | //! Load(shape, tol) and find intersection points for |
50 | //! each curve using method Init(curve). For |
51 | //! iteration by intersection points method More() and |
52 | //! Next() should be used. |
53 | //! |
54 | //! Example: |
55 | //! Inter.Load(shape, tol); |
56 | //! for( i =1; i <= nbCurves;i++) |
57 | //! { |
58 | //! Inter.Init(curve); |
59 | //! for( ;Inter.More(); Inter.Next()) |
60 | //! { |
61 | //! ....... |
62 | //! } |
63 | //! } |
64 | class BRepIntCurveSurface_Inter |
65 | { |
66 | public: |
67 | |
68 | DEFINE_STANDARD_ALLOC |
69 | |
70 | |
71 | //! Empty constructor; |
72 | Standard_EXPORT BRepIntCurveSurface_Inter(); |
73 | |
74 | //! Load the Shape, the curve and initialize the |
75 | //! tolerance used for the classification. |
76 | Standard_EXPORT void Init (const TopoDS_Shape& theShape, const GeomAdaptor_Curve& theCurve, const Standard_Real theTol); |
77 | |
78 | //! Load the Shape, the curve and initialize the |
79 | //! tolerance used for the classification. |
80 | Standard_EXPORT void Init (const TopoDS_Shape& theShape, const gp_Lin& theLine, const Standard_Real theTol); |
81 | |
82 | //! Load the Shape, and initialize the |
83 | //! tolerance used for the classification. |
84 | Standard_EXPORT void Load (const TopoDS_Shape& theShape, const Standard_Real theTol); |
85 | |
86 | //! Method to find intersections of specified curve with loaded shape. |
87 | Standard_EXPORT void Init (const GeomAdaptor_Curve& theCurve); |
88 | |
89 | //! returns True if there is a current face. |
90 | Standard_EXPORT Standard_Boolean More() const; |
91 | |
92 | //! Sets the next intersection point to check. |
93 | Standard_EXPORT void Next(); |
94 | |
95 | //! returns the current Intersection point. |
96 | Standard_EXPORT IntCurveSurface_IntersectionPoint Point() const; |
97 | |
98 | //! returns the current geometric Point |
99 | Standard_EXPORT const gp_Pnt& Pnt() const; |
100 | |
101 | //! returns the U parameter of the current point |
102 | //! on the current face. |
103 | Standard_EXPORT Standard_Real U() const; |
104 | |
105 | //! returns the V parameter of the current point |
106 | //! on the current face. |
107 | Standard_EXPORT Standard_Real V() const; |
108 | |
109 | //! returns the parameter of the current point |
110 | //! on the curve. |
111 | Standard_EXPORT Standard_Real W() const; |
112 | |
113 | //! returns the current state (IN or ON) |
114 | Standard_EXPORT TopAbs_State State() const; |
115 | |
116 | //! returns the transition of the line on the surface (IN or OUT or UNKNOWN) |
117 | Standard_EXPORT IntCurveSurface_TransitionOnCurve Transition() const; |
118 | |
119 | //! returns the current face. |
120 | Standard_EXPORT const TopoDS_Face& Face() const; |
121 | |
122 | |
123 | |
124 | |
125 | protected: |
126 | |
127 | |
128 | //! Internal function |
129 | Standard_EXPORT void Find(); |
130 | |
131 | //! Method chec found intersection point |
132 | Standard_EXPORT Standard_Boolean FindPoint(); |
133 | |
134 | //! Method to clear fields of class |
135 | Standard_EXPORT void Clear(); |
136 | |
137 | |
138 | |
139 | |
140 | private: |
141 | |
142 | |
143 | |
144 | Standard_Real myTolerance; |
145 | Handle(GeomAdaptor_HCurve) myCurve; |
146 | IntCurveSurface_HInter myIntcs; |
147 | Standard_Integer myCurrentindex; |
148 | Standard_Integer myCurrentnbpoints; |
149 | Handle(BRepTopAdaptor_TopolTool) myFastClass; |
150 | TopAbs_State myCurrentstate; |
151 | Standard_Real myCurrentU; |
152 | Standard_Real myCurrentV; |
153 | Bnd_Box myCurveBox; |
154 | Standard_Integer myIndFace; |
155 | TopTools_SequenceOfShape myFaces; |
156 | Handle(Bnd_HArray1OfBox) myFaceBoxes; |
157 | |
158 | |
159 | }; |
160 | |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | |
167 | #endif // _BRepIntCurveSurface_Inter_HeaderFile |