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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IntCurvesFace_Intersector_HeaderFile
18 #define _IntCurvesFace_Intersector_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
38 class Adaptor3d_HCurve;
40 class IntCurveSurface_HInter;
46 class IntCurvesFace_Intersector
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);
69 //! Perform the intersection between the
70 //! segment L and the loaded face.
72 //! PInf is the smallest parameter on the line
73 //! PSup is the highest parmaeter on the line
75 //! For an infinite line PInf and PSup can be
77 Standard_EXPORT void Perform (const gp_Lin& L, const Standard_Real PInf, const Standard_Real PSup);
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);
83 //! Return the surface type
84 Standard_EXPORT GeomAbs_SurfaceType SurfaceType() const;
86 //! True is returned when the intersection have been computed.
87 Standard_Boolean IsDone() const;
89 Standard_Integer NbPnt() const;
91 //! Returns the U parameter of the ith intersection point
93 Standard_Real UParameter (const Standard_Integer I) const;
95 //! Returns the V parameter of the ith intersection point
97 Standard_Real VParameter (const Standard_Integer I) const;
99 //! Returns the parameter of the ith intersection point
101 Standard_Real WParameter (const Standard_Integer I) const;
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;
107 //! Returns the ith transition of the line on the surface.
108 IntCurveSurface_TransitionOnCurve Transition (const Standard_Integer I) const;
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)
114 //! ( the point is on a boudary of the face).
115 TopAbs_State State (const Standard_Integer I) const;
117 //! Returns true if curve is parallel or belongs face surface
118 //! This case is recognized only for some pairs
119 //! of analytical curves and surfaces (plane - line, ...)
120 Standard_Boolean IsParallel() const;
122 //! Returns the significant face used to determine
123 //! the intersection.
124 const TopoDS_Face& Face() const;
126 Standard_EXPORT TopAbs_State ClassifyUVPoint (const gp_Pnt2d& Puv) const;
128 Standard_EXPORT Bnd_Box Bounding() const;
130 //! Sets the boundary tolerance flag
131 Standard_EXPORT void SetUseBoundToler(Standard_Boolean UseBToler );
133 //! Returns the boundary tolerance flag
134 Standard_EXPORT Standard_Boolean GetUseBoundToler() const;
136 Standard_EXPORT void Destroy();
137 ~IntCurvesFace_Intersector()
154 Standard_EXPORT void InternalCall (const IntCurveSurface_HInter& HICS, const Standard_Real pinf, const Standard_Real psup);
157 Handle(BRepTopAdaptor_TopolTool) myTopolTool;
158 Handle(BRepAdaptor_HSurface) Hsurface;
160 IntCurveSurface_SequenceOfPnt SeqPnt;
161 TColStd_SequenceOfInteger mySeqState;
162 Standard_Boolean done;
163 Standard_Integer nbpnt;
165 Standard_Address PtrOnPolyhedron;
166 Standard_Address PtrOnBndBounding;
167 Standard_Boolean myUseBoundTol;
168 Standard_Boolean myIsParallel; //Curve is "parallel" face surface
169 //This case is recognized only for some pairs
170 //of analytical curves and surfaces (plane - line, ...)
176 #include <IntCurvesFace_Intersector.lxx>
182 #endif // _IntCurvesFace_Intersector_HeaderFile