0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / IntCurvesFace / IntCurvesFace_Intersector.hxx
CommitLineData
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
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>
34class BRepTopAdaptor_TopolTool;
35class BRepAdaptor_HSurface;
36class TopoDS_Face;
37class gp_Lin;
38class Adaptor3d_HCurve;
39class gp_Pnt;
40class IntCurveSurface_HInter;
41class gp_Pnt2d;
42class Bnd_Box;
43
44
45
46class IntCurvesFace_Intersector
47{
48public:
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).
a0258acd 59 //! If aRestr = true UV bounding box of face is used to restrict
60 //! it's underlined surface,
58e14d59 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).
a0258acd 65 Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F, const Standard_Real aTol,
58e14d59 66 const Standard_Boolean aRestr = Standard_True,
67 const Standard_Boolean UseBToler = Standard_True);
42cf5bc1 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;
f84edf58 116
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;
121
42cf5bc1 122 //! Returns the significant face used to determine
123 //! the intersection.
124 const TopoDS_Face& Face() const;
125
126 Standard_EXPORT TopAbs_State ClassifyUVPoint (const gp_Pnt2d& Puv) const;
127
128 Standard_EXPORT Bnd_Box Bounding() const;
58e14d59 129
130 //! Sets the boundary tolerance flag
131 Standard_EXPORT void SetUseBoundToler(Standard_Boolean UseBToler );
132
133 //! Returns the boundary tolerance flag
134 Standard_EXPORT Standard_Boolean GetUseBoundToler() const;
42cf5bc1 135
136 Standard_EXPORT void Destroy();
137~IntCurvesFace_Intersector()
138{
139 Destroy();
140}
141
142
143
144
145protected:
146
147
148
149
150
151private:
152
153
154 Standard_EXPORT void InternalCall (const IntCurveSurface_HInter& HICS, const Standard_Real pinf, const Standard_Real psup);
155
156
157 Handle(BRepTopAdaptor_TopolTool) myTopolTool;
158 Handle(BRepAdaptor_HSurface) Hsurface;
159 Standard_Real Tol;
160 IntCurveSurface_SequenceOfPnt SeqPnt;
161 TColStd_SequenceOfInteger mySeqState;
162 Standard_Boolean done;
e8dec5e1 163 Standard_Boolean myReady;
42cf5bc1 164 Standard_Integer nbpnt;
165 TopoDS_Face face;
166 Standard_Address PtrOnPolyhedron;
167 Standard_Address PtrOnBndBounding;
58e14d59 168 Standard_Boolean myUseBoundTol;
f84edf58 169 Standard_Boolean myIsParallel; //Curve is "parallel" face surface
170 //This case is recognized only for some pairs
171 //of analytical curves and surfaces (plane - line, ...)
42cf5bc1 172
173
174};
175
176
177#include <IntCurvesFace_Intersector.lxx>
178
179
180
181
182
183#endif // _IntCurvesFace_Intersector_HeaderFile