0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / IntPatch / IntPatch_TheIWalking.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-05-06
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1992-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 _IntPatch_TheIWalking_HeaderFile
18#define _IntPatch_TheIWalking_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
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>
31#include <gp_Vec.hxx>
32#include <gp_Dir2d.hxx>
33#include <TColStd_SequenceOfInteger.hxx>
8d795b51 34#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
42cf5bc1 35#include <IntPatch_SequenceOfIWLineOfTheIWalking.hxx>
36#include <IntSurf_SequenceOfInteriorPoint.hxx>
37#include <Standard_Integer.hxx>
38#include <TColStd_SequenceOfReal.hxx>
39#include <IntWalk_StatusDeflection.hxx>
d07a6c39 40#include <Bnd_Range.hxx>
42cf5bc1 41class StdFail_NotDone;
42class Standard_OutOfRange;
43class IntSurf_PathPoint;
44class IntSurf_PathPointTool;
45class IntSurf_InteriorPoint;
46class IntSurf_InteriorPointTool;
47class Adaptor3d_HSurface;
48class Adaptor3d_HSurfaceTool;
49class IntPatch_TheSurfFunction;
50class IntPatch_TheIWLineOfTheIWalking;
42cf5bc1 51class IntSurf_PntOn2S;
92a55b01 52class math_FunctionSetRoot;
42cf5bc1 53
42cf5bc1 54class IntPatch_TheIWalking
55{
56public:
57
58 DEFINE_STANDARD_ALLOC
59
60
36b9ff75 61 //! Deflection is the maximum deflection admitted between two
62 //! consecutive points on a resulting polyline.
63 //! Step is the maximum increment admitted between two
64 //! consecutive points (in 2d space).
65 //! Epsilon is the tolerance beyond which 2 points
66 //! are confused.
8d795b51 67 //! theToFillHoles is the flag defining whether possible holes
68 //! between resulting curves are filled or not
69 //! in case of IntPatch walking theToFillHoles is False
70 Standard_EXPORT IntPatch_TheIWalking(const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Step,
71 const Standard_Boolean theToFillHoles = Standard_False);
42cf5bc1 72
36b9ff75 73 //! Deflection is the maximum deflection admitted between two
74 //! consecutive points on a resulting polyline.
75 //! Step is the maximum increment admitted between two
76 //! consecutive points (in 2d space).
77 //! Epsilon is the tolerance beyond which 2 points
78 //! are confused
42cf5bc1 79 void SetTolerance (const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Step);
80
36b9ff75 81 //! Searches a set of polylines starting on a point of Pnts1
82 //! or Pnts2.
83 //! Each point on a resulting polyline verifies F(u,v)=0
42cf5bc1 84 Standard_EXPORT void Perform (const IntSurf_SequenceOfPathPoint& Pnts1, const IntSurf_SequenceOfInteriorPoint& Pnts2, IntPatch_TheSurfFunction& Func, const Handle(Adaptor3d_HSurface)& S, const Standard_Boolean Reversed = Standard_False);
85
36b9ff75 86 //! Searches a set of polylines starting on a point of Pnts1.
87 //! Each point on a resulting polyline verifies F(u,v)=0
42cf5bc1 88 Standard_EXPORT void Perform (const IntSurf_SequenceOfPathPoint& Pnts1, IntPatch_TheSurfFunction& Func, const Handle(Adaptor3d_HSurface)& S, const Standard_Boolean Reversed = Standard_False);
89
36b9ff75 90 //! Returns true if the calculus was successful.
42cf5bc1 91 Standard_Boolean IsDone() const;
92
36b9ff75 93 //! Returns the number of resulting polylines.
94 //! An exception is raised if IsDone returns False.
42cf5bc1 95 Standard_Integer NbLines() const;
96
36b9ff75 97 //! Returns the polyline of range Index.
98 //! An exception is raised if IsDone is False.
99 //! An exception is raised if Index<=0 or Index>NbLines.
42cf5bc1 100 const Handle(IntPatch_TheIWLineOfTheIWalking)& Value (const Standard_Integer Index) const;
101
36b9ff75 102 //! Returns the number of points belonging to Pnts on which no
103 //! line starts or ends.
104 //! An exception is raised if IsDone returns False.
42cf5bc1 105 Standard_Integer NbSinglePnts() const;
106
36b9ff75 107 //! Returns the point of range Index .
108 //! An exception is raised if IsDone returns False.
109 //! An exception is raised if Index<=0 or
110 //! Index > NbSinglePnts.
42cf5bc1 111 const IntSurf_PathPoint& SinglePnt (const Standard_Integer Index) const;
112
113
114
115
116protected:
117
118
119 Standard_EXPORT Standard_Boolean Cadrage (math_Vector& BornInf, math_Vector& BornSup, math_Vector& UVap, Standard_Real& Step, const Standard_Integer StepSign) const;
120
121 Standard_EXPORT Standard_Boolean TestArretPassage (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, IntPatch_TheSurfFunction& Section, math_Vector& UV, Standard_Integer& Irang);
122
123 Standard_EXPORT Standard_Boolean TestArretPassage (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const math_Vector& UV, const Standard_Integer Index, Standard_Integer& Irang);
124
125 Standard_EXPORT Standard_Boolean TestArretAjout (IntPatch_TheSurfFunction& Section, math_Vector& UV, Standard_Integer& Irang, IntSurf_PntOn2S& PSol);
126
8d795b51 127 Standard_EXPORT void FillPntsInHoles (IntPatch_TheSurfFunction& Section,
128 TColStd_SequenceOfInteger& CopySeqAlone,
129 IntSurf_SequenceOfInteriorPoint& PntsInHoles);
130
42cf5bc1 131 Standard_EXPORT void TestArretCadre (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const Handle(IntPatch_TheIWLineOfTheIWalking)& Line, IntPatch_TheSurfFunction& Section, math_Vector& UV, Standard_Integer& Irang);
132
133 Standard_EXPORT IntWalk_StatusDeflection TestDeflection (IntPatch_TheSurfFunction& Section, const Standard_Boolean Finished, const math_Vector& UV, const IntWalk_StatusDeflection StatusPrecedent, Standard_Integer& NbDivision, Standard_Real& Step, const Standard_Integer StepSign);
134
135 Standard_EXPORT void ComputeOpenLine (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const IntSurf_SequenceOfPathPoint& Pnts1, IntPatch_TheSurfFunction& Section, Standard_Boolean& Rajout);
136
137 Standard_EXPORT void OpenLine (const Standard_Integer N, const IntSurf_PntOn2S& Psol, const IntSurf_SequenceOfPathPoint& Pnts1, IntPatch_TheSurfFunction& Section, const Handle(IntPatch_TheIWLineOfTheIWalking)& Line);
138
8d795b51 139 Standard_EXPORT Standard_Boolean IsValidEndPoint (const Standard_Integer IndOfPoint, const Standard_Integer IndOfLine);
140
141 Standard_EXPORT void RemoveTwoEndPoints (const Standard_Integer IndOfPoint);
142
143 Standard_EXPORT Standard_Boolean IsPointOnLine (const gp_Pnt2d& theP2d, const Standard_Integer Irang);
144
42cf5bc1 145 Standard_EXPORT void ComputeCloseLine (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const IntSurf_SequenceOfPathPoint& Pnts1, const IntSurf_SequenceOfInteriorPoint& Pnts2, IntPatch_TheSurfFunction& Section, Standard_Boolean& Rajout);
146
147 Standard_EXPORT void AddPointInCurrentLine (const Standard_Integer N, const IntSurf_PathPoint& PathPnt, const Handle(IntPatch_TheIWLineOfTheIWalking)& CurrentLine) const;
148
149 Standard_EXPORT void MakeWalkingPoint (const Standard_Integer Case, const Standard_Real U, const Standard_Real V, IntPatch_TheSurfFunction& Section, IntSurf_PntOn2S& Psol);
150
36b9ff75 151 //! Clears up internal containers
42cf5bc1 152 Standard_EXPORT void Clear();
153
92a55b01 154 //! Returns TRUE if thePOn2S is in one of existing lines.
155 Standard_EXPORT Standard_Boolean IsPointOnLine(const IntSurf_PntOn2S& thePOn2S,
156 const math_Vector& theInfBounds,
157 const math_Vector& theSupBounds,
158 math_FunctionSetRoot& theSolver,
159 IntPatch_TheSurfFunction& theFunc);
42cf5bc1 160
161
162
163private:
164
165
166
167 Standard_Boolean done;
168 IntSurf_SequenceOfPathPoint seqSingle;
169 Standard_Real fleche;
170 Standard_Real pas;
171 math_Vector tolerance;
172 Standard_Real epsilon;
173 Standard_Boolean reversed;
174 IntWalk_VectorOfWalkingData wd1;
175 IntWalk_VectorOfWalkingData wd2;
176 IntWalk_VectorOfInteger nbMultiplicities;
d07a6c39 177 Bnd_Range mySRangeU; // Estimated U-range for section curve
178 Bnd_Range mySRangeV; // Estimated V-range for section curve
42cf5bc1 179 Standard_Real Um;
180 Standard_Real UM;
181 Standard_Real Vm;
182 Standard_Real VM;
183 IntSurf_PntOn2S previousPoint;
184 gp_Vec previousd3d;
185 gp_Dir2d previousd2d;
186 TColStd_SequenceOfInteger seqAjout;
8d795b51 187 TColStd_SequenceOfInteger seqAlone;
188 TColStd_DataMapOfIntegerListOfInteger PointLineLine;
42cf5bc1 189 IntPatch_SequenceOfIWLineOfTheIWalking lines;
8d795b51 190 Standard_Boolean ToFillHoles;
42cf5bc1 191
192
193};
194
195#define ThePointOfPath IntSurf_PathPoint
196#define ThePointOfPath_hxx <IntSurf_PathPoint.hxx>
197#define ThePointOfPathTool IntSurf_PathPointTool
198#define ThePointOfPathTool_hxx <IntSurf_PathPointTool.hxx>
199#define ThePOPIterator IntSurf_SequenceOfPathPoint
200#define ThePOPIterator_hxx <IntSurf_SequenceOfPathPoint.hxx>
201#define ThePointOfLoop IntSurf_InteriorPoint
202#define ThePointOfLoop_hxx <IntSurf_InteriorPoint.hxx>
203#define ThePointOfLoopTool IntSurf_InteriorPointTool
204#define ThePointOfLoopTool_hxx <IntSurf_InteriorPointTool.hxx>
205#define ThePOLIterator IntSurf_SequenceOfInteriorPoint
206#define ThePOLIterator_hxx <IntSurf_SequenceOfInteriorPoint.hxx>
207#define ThePSurface Handle(Adaptor3d_HSurface)
208#define ThePSurface_hxx <Adaptor3d_HSurface.hxx>
209#define ThePSurfaceTool Adaptor3d_HSurfaceTool
210#define ThePSurfaceTool_hxx <Adaptor3d_HSurfaceTool.hxx>
211#define TheIWFunction IntPatch_TheSurfFunction
212#define TheIWFunction_hxx <IntPatch_TheSurfFunction.hxx>
213#define IntWalk_TheIWLine IntPatch_TheIWLineOfTheIWalking
214#define IntWalk_TheIWLine_hxx <IntPatch_TheIWLineOfTheIWalking.hxx>
215#define IntWalk_SequenceOfIWLine IntPatch_SequenceOfIWLineOfTheIWalking
216#define IntWalk_SequenceOfIWLine_hxx <IntPatch_SequenceOfIWLineOfTheIWalking.hxx>
42cf5bc1 217#define Handle_IntWalk_TheIWLine Handle(IntPatch_TheIWLineOfTheIWalking)
42cf5bc1 218#define IntWalk_IWalking IntPatch_TheIWalking
219#define IntWalk_IWalking_hxx <IntPatch_TheIWalking.hxx>
220
221#include <IntWalk_IWalking.lxx>
222
223#undef ThePointOfPath
224#undef ThePointOfPath_hxx
225#undef ThePointOfPathTool
226#undef ThePointOfPathTool_hxx
227#undef ThePOPIterator
228#undef ThePOPIterator_hxx
229#undef ThePointOfLoop
230#undef ThePointOfLoop_hxx
231#undef ThePointOfLoopTool
232#undef ThePointOfLoopTool_hxx
233#undef ThePOLIterator
234#undef ThePOLIterator_hxx
235#undef ThePSurface
236#undef ThePSurface_hxx
237#undef ThePSurfaceTool
238#undef ThePSurfaceTool_hxx
239#undef TheIWFunction
240#undef TheIWFunction_hxx
241#undef IntWalk_TheIWLine
242#undef IntWalk_TheIWLine_hxx
243#undef IntWalk_SequenceOfIWLine
244#undef IntWalk_SequenceOfIWLine_hxx
42cf5bc1 245#undef Handle_IntWalk_TheIWLine
42cf5bc1 246#undef IntWalk_IWalking
247#undef IntWalk_IWalking_hxx
248
249
250
251
252#endif // _IntPatch_TheIWalking_HeaderFile