1 // Created on: 1993-12-06
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1993-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 _BRepBlend_Walking_HeaderFile
18 #define _BRepBlend_Walking_HeaderFile
19 
20 #include <Adaptor3d_Surface.hxx>
21 #include <Blend_Point.hxx>
22 #include <Blend_SequenceOfPoint.hxx>
23 #include <Blend_Status.hxx>
24 #include <BRepBlend_SequenceOfPointOnRst.hxx>
25 #include <ChFiDS_ElSpine.hxx>
26 #include <math_Vector.hxx>
27 #include <TopAbs_State.hxx>
28 
29 class BRepBlend_Line;
30 class Adaptor3d_TopolTool;
31 class StdFail_NotDone;
32 class Adaptor3d_HVertex;
33 class BRepBlend_HCurve2dTool;
34 class Adaptor3d_HSurfaceTool;
35 class BRepBlend_HCurveTool;
36 class BRepBlend_BlendTool;
37 class BRepBlend_PointOnRst;
38 class BRepBlend_Extremity;
39 class Blend_Point;
40 class Blend_Function;
41 class Blend_FuncInv;
42 class gp_Pnt;
43 class gp_Pnt2d;
44 class IntSurf_Transition;
45 
46 class BRepBlend_Walking
47 {
48 public:
49 
50   DEFINE_STANDARD_ALLOC
51 
52 
53   Standard_EXPORT BRepBlend_Walking(const Handle(Adaptor3d_Surface)& Surf1, const Handle(Adaptor3d_Surface)& Surf2, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_TopolTool)& Domain2, const Handle(ChFiDS_ElSpine)& HGuide);
54 
55   //! To define different domains for control and clipping.
56   Standard_EXPORT void SetDomainsToRecadre (const Handle(Adaptor3d_TopolTool)& RecDomain1, const Handle(Adaptor3d_TopolTool)& RecDomain2);
57 
58   //! To define singular points computed before walking.
59   Standard_EXPORT void AddSingularPoint (const Blend_Point& P);
60 
61   Standard_EXPORT void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
62 
63   Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_Function& F, const Standard_Real Pdep, math_Vector& ParDep, const Standard_Real Tolesp, const Standard_Real TolGuide, TopAbs_State& Pos1, TopAbs_State& Pos2);
64 
65   Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& ParDep, const Standard_Real Tolesp, const Standard_Real TolGuide, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, Standard_Real& Psol, math_Vector& ParSol);
66 
67   Standard_EXPORT Standard_Boolean Continu (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real P);
68 
69   Standard_EXPORT Standard_Boolean Continu (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real P, const Standard_Boolean OnS1);
70 
71   Standard_EXPORT Standard_Boolean Complete (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pmin);
72 
73   Standard_EXPORT void ClassificationOnS1 (const Standard_Boolean C);
74 
75   Standard_EXPORT void ClassificationOnS2 (const Standard_Boolean C);
76 
77   Standard_EXPORT void Check2d (const Standard_Boolean C);
78 
79   Standard_EXPORT void Check (const Standard_Boolean C);
80 
81     Standard_Boolean TwistOnS1() const;
82 
83     Standard_Boolean TwistOnS2() const;
84 
85     Standard_Boolean IsDone() const;
86 
87     const Handle(BRepBlend_Line)& Line() const;
88 
89 
90 
91 
92 protected:
93 
94 
95 
96 
97 
98 private:
99 
100 
101   Standard_EXPORT void InternalPerform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Bound);
102 
103   Standard_EXPORT Standard_Boolean CorrectExtremityOnOneRst (const Standard_Integer IndexOfRst, const Standard_Real theU, const Standard_Real theV, const Standard_Real theParam, const gp_Pnt& thePntOnRst, Standard_Real& NewU, Standard_Real& NewV, gp_Pnt& NewPoint, Standard_Real& NewParam) const;
104 
105   Standard_EXPORT Standard_Integer ArcToRecadre (const Standard_Boolean OnFirst, const math_Vector& Sol, const Standard_Integer PrevIndex, gp_Pnt2d& lpt2d, gp_Pnt2d& pt2d, Standard_Real& ponarc);
106 
107   Standard_EXPORT Standard_Boolean Recadre (Blend_FuncInv& FInv, const Standard_Boolean OnFirst, const math_Vector& Sol, math_Vector& Solrst, Standard_Integer& Indexsol, Standard_Boolean& IsVtx, Handle(Adaptor3d_HVertex)& Vtx, const Standard_Real Extrap = 0.0);
108 
109   Standard_EXPORT void Transition (const Standard_Boolean OnFirst, const Handle(Adaptor2d_Curve2d)& A, const Standard_Real Param, IntSurf_Transition& TLine, IntSurf_Transition& TArc);
110 
111   Standard_EXPORT void MakeExtremity (BRepBlend_Extremity& Extrem, const Standard_Boolean OnFirst, const Standard_Integer Index, const Standard_Real Param, const Standard_Boolean IsVtx, const Handle(Adaptor3d_HVertex)& Vtx);
112 
113   Standard_EXPORT void MakeSingularExtremity (BRepBlend_Extremity& Extrem, const Standard_Boolean OnFirst, const Handle(Adaptor3d_HVertex)& Vtx);
114 
115   Standard_EXPORT Blend_Status CheckDeflection (const Standard_Boolean OnFirst, const Blend_Point& CurPoint);
116 
117   Standard_EXPORT Blend_Status TestArret (Blend_Function& F, const Blend_Status State, const Standard_Boolean TestDeflection = Standard_True, const Standard_Boolean TestSolution = Standard_True, const Standard_Boolean TestLengthStep = Standard_False);
118 
119 
120   Blend_Point previousP;
121   Handle(BRepBlend_Line) line;
122   math_Vector sol;
123   Blend_SequenceOfPoint jalons;
124   Handle(Adaptor3d_Surface) surf1;
125   Handle(Adaptor3d_Surface) surf2;
126   Handle(Adaptor3d_TopolTool) domain1;
127   Handle(Adaptor3d_TopolTool) domain2;
128   Handle(Adaptor3d_TopolTool) recdomain1;
129   Handle(Adaptor3d_TopolTool) recdomain2;
130   Handle(ChFiDS_ElSpine) hguide;
131   Standard_Boolean ToCorrectOnRst1;
132   Standard_Boolean ToCorrectOnRst2;
133   Standard_Real CorrectedParam;
134   Standard_Real tolesp;
135   Standard_Real tolgui;
136   Standard_Real pasmax;
137   Standard_Real fleche;
138   Standard_Real param;
139   Standard_Real sens;
140   Standard_Boolean done;
141   Standard_Boolean rebrou;
142   Standard_Boolean iscomplete;
143   Standard_Boolean comptra;
144   Standard_Boolean clasonS1;
145   Standard_Boolean clasonS2;
146   Standard_Boolean check2d;
147   Standard_Boolean check;
148   Standard_Boolean twistflag1;
149   Standard_Boolean twistflag2;
150 
151 
152 };
153 
154 #define TheVertex Handle(Adaptor3d_HVertex)
155 #define TheVertex_hxx <Adaptor3d_HVertex.hxx>
156 #define TheArc Handle(Adaptor2d_Curve2d)
157 #define TheArc_hxx <Adaptor2d_Curve2d.hxx>
158 #define TheSurface Handle(Adaptor3d_Surface)
159 #define TheSurface_hxx <Adaptor3d_Surface.hxx>
160 #define TheCurve Handle(Adaptor3d_Curve)
161 #define TheCurve_hxx <Adaptor3d_Curve.hxx>
162 #define TheVertexTool Standard_Integer
163 #define TheVertexTool_hxx <Standard_Integer.hxx>
164 #define TheArcTool BRepBlend_HCurve2dTool
165 #define TheArcTool_hxx <BRepBlend_HCurve2dTool.hxx>
166 #define TheSurfaceTool Adaptor3d_HSurfaceTool
167 #define TheSurfaceTool_hxx <Adaptor3d_HSurfaceTool.hxx>
168 #define TheCurveTool BRepBlend_HCurveTool
169 #define TheCurveTool_hxx <BRepBlend_HCurveTool.hxx>
170 #define Handle_TheTopolTool Handle(Adaptor3d_TopolTool)
171 #define TheTopolTool Adaptor3d_TopolTool
172 #define TheTopolTool_hxx <Adaptor3d_TopolTool.hxx>
173 #define TheBlendTool BRepBlend_BlendTool
174 #define TheBlendTool_hxx <BRepBlend_BlendTool.hxx>
175 #define ThePointOnRst BRepBlend_PointOnRst
176 #define ThePointOnRst_hxx <BRepBlend_PointOnRst.hxx>
177 #define TheSeqPointOnRst BRepBlend_SequenceOfPointOnRst
178 #define TheSeqPointOnRst_hxx <BRepBlend_SequenceOfPointOnRst.hxx>
179 #define TheExtremity BRepBlend_Extremity
180 #define TheExtremity_hxx <BRepBlend_Extremity.hxx>
181 #define Handle_TheLine Handle(BRepBlend_Line)
182 #define TheLine BRepBlend_Line
183 #define TheLine_hxx <BRepBlend_Line.hxx>
184 #define Blend_Walking BRepBlend_Walking
185 #define Blend_Walking_hxx <BRepBlend_Walking.hxx>
186 
187 #include <Blend_Walking.lxx>
188 
189 #undef TheVertex
190 #undef TheVertex_hxx
191 #undef TheArc
192 #undef TheArc_hxx
193 #undef TheSurface
194 #undef TheSurface_hxx
195 #undef TheCurve
196 #undef TheCurve_hxx
197 #undef TheVertexTool
198 #undef TheVertexTool_hxx
199 #undef TheArcTool
200 #undef TheArcTool_hxx
201 #undef TheSurfaceTool
202 #undef TheSurfaceTool_hxx
203 #undef TheCurveTool
204 #undef TheCurveTool_hxx
205 #undef Handle_TheTopolTool
206 #undef TheTopolTool
207 #undef TheTopolTool_hxx
208 #undef TheBlendTool
209 #undef TheBlendTool_hxx
210 #undef ThePointOnRst
211 #undef ThePointOnRst_hxx
212 #undef TheSeqPointOnRst
213 #undef TheSeqPointOnRst_hxx
214 #undef TheExtremity
215 #undef TheExtremity_hxx
216 #undef Handle_TheLine
217 #undef TheLine
218 #undef TheLine_hxx
219 #undef Blend_Walking
220 #undef Blend_Walking_hxx
221 
222 
223 
224 
225 #endif // _BRepBlend_Walking_HeaderFile
226