1 // Created on: 1993-02-05
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1993-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 _Contap_TheIWalking_HeaderFile
18 #define _Contap_TheIWalking_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <IntSurf_SequenceOfPathPoint.hxx>
26 #include <Standard_Real.hxx>
27 #include <math_Vector.hxx>
28 #include <IntWalk_VectorOfWalkingData.hxx>
29 #include <IntWalk_VectorOfInteger.hxx>
30 #include <IntSurf_PntOn2S.hxx>
32 #include <gp_Dir2d.hxx>
33 #include <TColStd_SequenceOfInteger.hxx>
34 #include <Contap_SequenceOfIWLineOfTheIWalking.hxx>
35 #include <IntSurf_SequenceOfInteriorPoint.hxx>
36 #include <Standard_Integer.hxx>
37 #include <TColStd_SequenceOfReal.hxx>
38 #include <IntWalk_StatusDeflection.hxx>
39 class StdFail_NotDone;
40 class Standard_OutOfRange;
41 class IntSurf_PathPoint;
42 class IntSurf_PathPointTool;
43 class IntSurf_InteriorPoint;
44 class IntSurf_InteriorPointTool;
45 class Adaptor3d_HSurface;
46 class Adaptor3d_HSurfaceTool;
47 class Contap_SurfFunction;
48 class Contap_TheIWLineOfTheIWalking;
49 class IntSurf_PntOn2S;
51 class Contap_TheIWalking
58 //! Deflection is the maximum deflection admitted between two
59 //! consecutive points on a resulting polyline.
60 //! Step is the maximum increment admitted between two
61 //! consecutive points (in 2d space).
62 //! Epsilon is the tolerance beyond which 2 points
64 Standard_EXPORT Contap_TheIWalking(const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Step);
66 //! Deflection is the maximum deflection admitted between two
67 //! consecutive points on a resulting polyline.
68 //! Step is the maximum increment admitted between two
69 //! consecutive points (in 2d space).
70 //! Epsilon is the tolerance beyond which 2 points
72 void SetTolerance (const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Step);
74 //! Searches a set of polylines starting on a point of Pnts1
76 //! Each point on a resulting polyline verifies F(u,v)=0
77 Standard_EXPORT void Perform (const IntSurf_SequenceOfPathPoint& Pnts1, const IntSurf_SequenceOfInteriorPoint& Pnts2, Contap_SurfFunction& Func, const Handle(Adaptor3d_HSurface)& S, const Standard_Boolean Reversed = Standard_False);
79 //! Searches a set of polylines starting on a point of Pnts1.
80 //! Each point on a resulting polyline verifies F(u,v)=0
81 Standard_EXPORT void Perform (const IntSurf_SequenceOfPathPoint& Pnts1, Contap_SurfFunction& Func, const Handle(Adaptor3d_HSurface)& S, const Standard_Boolean Reversed = Standard_False);
83 //! Returns true if the calculus was successful.
84 Standard_Boolean IsDone() const;
86 //! Returns the number of resulting polylines.
87 //! An exception is raised if IsDone returns False.
88 Standard_Integer NbLines() const;
90 //! Returns the polyline of range Index.
91 //! An exception is raised if IsDone is False.
92 //! An exception is raised if Index<=0 or Index>NbLines.
93 const Handle(Contap_TheIWLineOfTheIWalking)& Value (const Standard_Integer Index) const;
95 //! Returns the number of points belonging to Pnts on which no
96 //! line starts or ends.
97 //! An exception is raised if IsDone returns False.
98 Standard_Integer NbSinglePnts() const;
100 //! Returns the point of range Index .
101 //! An exception is raised if IsDone returns False.
102 //! An exception is raised if Index<=0 or
103 //! Index > NbSinglePnts.
104 const IntSurf_PathPoint& SinglePnt (const Standard_Integer Index) const;
112 Standard_EXPORT Standard_Boolean Cadrage (math_Vector& BornInf, math_Vector& BornSup, math_Vector& UVap, Standard_Real& Step, const Standard_Integer StepSign) const;
114 Standard_EXPORT Standard_Boolean TestArretPassage (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, Contap_SurfFunction& Section, math_Vector& UV, Standard_Integer& Irang);
116 Standard_EXPORT Standard_Boolean TestArretPassage (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const math_Vector& UV, const Standard_Integer Index, Standard_Integer& Irang);
118 Standard_EXPORT Standard_Boolean TestArretAjout (Contap_SurfFunction& Section, math_Vector& UV, Standard_Integer& Irang, IntSurf_PntOn2S& PSol);
120 Standard_EXPORT void TestArretCadre (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const Handle(Contap_TheIWLineOfTheIWalking)& Line, Contap_SurfFunction& Section, math_Vector& UV, Standard_Integer& Irang);
122 Standard_EXPORT IntWalk_StatusDeflection TestDeflection (Contap_SurfFunction& Section, const Standard_Boolean Finished, const math_Vector& UV, const IntWalk_StatusDeflection StatusPrecedent, Standard_Integer& NbDivision, Standard_Real& Step, const Standard_Integer StepSign);
124 Standard_EXPORT void ComputeOpenLine (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const IntSurf_SequenceOfPathPoint& Pnts1, Contap_SurfFunction& Section, Standard_Boolean& Rajout);
126 Standard_EXPORT void OpenLine (const Standard_Integer N, const IntSurf_PntOn2S& Psol, const IntSurf_SequenceOfPathPoint& Pnts1, Contap_SurfFunction& Section, const Handle(Contap_TheIWLineOfTheIWalking)& Line);
128 Standard_EXPORT void ComputeCloseLine (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const IntSurf_SequenceOfPathPoint& Pnts1, const IntSurf_SequenceOfInteriorPoint& Pnts2, Contap_SurfFunction& Section, Standard_Boolean& Rajout);
130 Standard_EXPORT void AddPointInCurrentLine (const Standard_Integer N, const IntSurf_PathPoint& PathPnt, const Handle(Contap_TheIWLineOfTheIWalking)& CurrentLine) const;
132 Standard_EXPORT void MakeWalkingPoint (const Standard_Integer Case, const Standard_Real U, const Standard_Real V, Contap_SurfFunction& Section, IntSurf_PntOn2S& Psol);
134 //! Clears up internal containers
135 Standard_EXPORT void Clear();
144 Standard_Boolean done;
145 IntSurf_SequenceOfPathPoint seqSingle;
146 Standard_Real fleche;
148 math_Vector tolerance;
149 Standard_Real epsilon;
150 Standard_Boolean reversed;
151 IntWalk_VectorOfWalkingData wd1;
152 IntWalk_VectorOfWalkingData wd2;
153 IntWalk_VectorOfInteger nbMultiplicities;
158 IntSurf_PntOn2S previousPoint;
160 gp_Dir2d previousd2d;
161 TColStd_SequenceOfInteger seqAjout;
162 Contap_SequenceOfIWLineOfTheIWalking lines;
167 #define ThePointOfPath IntSurf_PathPoint
168 #define ThePointOfPath_hxx <IntSurf_PathPoint.hxx>
169 #define ThePointOfPathTool IntSurf_PathPointTool
170 #define ThePointOfPathTool_hxx <IntSurf_PathPointTool.hxx>
171 #define ThePOPIterator IntSurf_SequenceOfPathPoint
172 #define ThePOPIterator_hxx <IntSurf_SequenceOfPathPoint.hxx>
173 #define ThePointOfLoop IntSurf_InteriorPoint
174 #define ThePointOfLoop_hxx <IntSurf_InteriorPoint.hxx>
175 #define ThePointOfLoopTool IntSurf_InteriorPointTool
176 #define ThePointOfLoopTool_hxx <IntSurf_InteriorPointTool.hxx>
177 #define ThePOLIterator IntSurf_SequenceOfInteriorPoint
178 #define ThePOLIterator_hxx <IntSurf_SequenceOfInteriorPoint.hxx>
179 #define ThePSurface Handle(Adaptor3d_HSurface)
180 #define ThePSurface_hxx <Adaptor3d_HSurface.hxx>
181 #define ThePSurfaceTool Adaptor3d_HSurfaceTool
182 #define ThePSurfaceTool_hxx <Adaptor3d_HSurfaceTool.hxx>
183 #define TheIWFunction Contap_SurfFunction
184 #define TheIWFunction_hxx <Contap_SurfFunction.hxx>
185 #define IntWalk_TheIWLine Contap_TheIWLineOfTheIWalking
186 #define IntWalk_TheIWLine_hxx <Contap_TheIWLineOfTheIWalking.hxx>
187 #define IntWalk_SequenceOfIWLine Contap_SequenceOfIWLineOfTheIWalking
188 #define IntWalk_SequenceOfIWLine_hxx <Contap_SequenceOfIWLineOfTheIWalking.hxx>
189 #define Handle_IntWalk_TheIWLine Handle(Contap_TheIWLineOfTheIWalking)
190 #define IntWalk_IWalking Contap_TheIWalking
191 #define IntWalk_IWalking_hxx <Contap_TheIWalking.hxx>
193 #include <IntWalk_IWalking.lxx>
195 #undef ThePointOfPath
196 #undef ThePointOfPath_hxx
197 #undef ThePointOfPathTool
198 #undef ThePointOfPathTool_hxx
199 #undef ThePOPIterator
200 #undef ThePOPIterator_hxx
201 #undef ThePointOfLoop
202 #undef ThePointOfLoop_hxx
203 #undef ThePointOfLoopTool
204 #undef ThePointOfLoopTool_hxx
205 #undef ThePOLIterator
206 #undef ThePOLIterator_hxx
208 #undef ThePSurface_hxx
209 #undef ThePSurfaceTool
210 #undef ThePSurfaceTool_hxx
212 #undef TheIWFunction_hxx
213 #undef IntWalk_TheIWLine
214 #undef IntWalk_TheIWLine_hxx
215 #undef IntWalk_SequenceOfIWLine
216 #undef IntWalk_SequenceOfIWLine_hxx
217 #undef Handle_IntWalk_TheIWLine
218 #undef IntWalk_IWalking
219 #undef IntWalk_IWalking_hxx
224 #endif // _Contap_TheIWalking_HeaderFile