0022922: Clean up warnings on uninitialized / unused variables
[occt.git] / src / Blend / Blend_CSWalking_4.gxx
CommitLineData
7fd59977 1void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
2// Blend_CSFuncInv& FuncInv,
3 math_Vector& sol,
4 const Standard_Real Bound)
5{
6
7 Standard_Real stepw = pasmax;
8 Standard_Real parprec = param;
9
10 Blend_Status State;
11 TopAbs_State situ;
12 Standard_Real w,U,V;
13 Standard_Integer nbarc;
7fd59977 14 Standard_Integer Index = 0;
15 Standard_Boolean Isvtx = Standard_False;
7fd59977 16 Standard_Integer Nbvar = Func.NbVariables();
17 Standard_Boolean Arrive,recad,echecrecad;
18 gp_Pnt2d p2d;
19// math_Vector tolerance(1,3),infbound(1,3),supbound(1,3),parinit(1,3);
20// math_Vector solrst(1,3);
21 math_Vector tolerance(1,Nbvar),infbound(1,Nbvar),supbound(1,Nbvar),
22 parinit(1,Nbvar);
23 math_Vector solrst(1,Nbvar);
24 TheVertex Vtx;
25 TheExtremity Exts,Extc;
26
27 //IntSurf_Transition Tline,Tarc;
28
29 Func.GetTolerance(tolerance,tolesp);
30 Func.GetBounds(infbound,supbound);
31
32 math_FunctionSetRoot rsnld(Func,tolerance,30);
33 parinit = sol;
34
35 param = parprec + sens*stepw;
36 Arrive = (sens *(param - Bound) > 0.) ;
37
38// if (Arrive) {
39// line->Clear();
40// }
41
42 while (!Arrive) {
43
44 Func.Set(param);
45 rsnld.Perform(Func,parinit,infbound,supbound);
46
47 if (!rsnld.IsDone()) {
48 State = Blend_StepTooLarge;
49 }
50 else {
51 rsnld.Root(sol);
52
53// situ1 = TheTopolTool::Classify(surf1,gp_Pnt2d(sol(1),sol(2)),
54// Max(tolerance(1),tolerance(2)));
55// situ2 = TheTopolTool::Classify(surf2,gp_Pnt2d(sol(3),sol(4)),
56// Max(tolerance(3),tolerance(4)));
57/*
58 situ = domain->Classify(gp_Pnt2d(sol(1),sol(2)),
59 Min(tolerance(1),tolerance(2)));
60*/
61 situ = domain->Classify(Func.Pnt2d(),
62 Min(tolerance(1),tolerance(2)));
63
64 w = Bound;
65 recad = Standard_False;
66 echecrecad = Standard_False;
67
68 if (situ == TopAbs_OUT || situ == TopAbs_ON) {
69 // pb inverse sur surf
70// recad = Recadre(FuncInv,sol,solrst,Index,Isvtx,Vtx);
71 Isvtx = Standard_False; // en attendant Recadre
72 if (recad) {
73 w = solrst(2);
74 }
75 else {
76 echecrecad = Standard_True;
77 }
78 }
79 if (!echecrecad) {
80 if (recad) {
81
82 // sol sur surf
83 State = Blend_OnRst1;
84 param = w;
85 domain->Init();
86 nbarc = 1;
87 while (nbarc < Index) {
88 nbarc++;
89 domain->Next();
90 }
91 p2d = TheArcTool::Value(domain->Value(),solrst(1));
92 sol(1) = p2d.X();
93 sol(2) = p2d.Y();
94 sol(3) = solrst(3);
95 Func.Set(param);
96 }
97 else {
98 State = Blend_OK;
99 }
100 State = TestArret(Func,sol,Standard_True,State);
101 }
102 else {
103 // Echec recadrage. On sort avec PointsConfondus
104 State = Blend_SamePoints;
105 }
106 }
107
108 switch (State) {
109 case Blend_OK :
110 {
111#ifdef DEB
112 if (Blend_GettraceDRAWSECT()){
113 Drawsect(surf,curv,param,Func);
114 }
115#endif
116
117 // Mettre a jour la ligne.
118 if (sens>0.) {
119 line->Append(previousP);
120 }
121 else {
122 line->Prepend(previousP);
123 }
124 parinit = sol;
125 parprec = param;
126
127 if (param == Bound) {
128 Arrive = Standard_True;
129/*
130 Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
131 Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
132*/
133 previousP.ParametersOnS(U,V);
134 Exts.SetValue(previousP.PointOnS(),U,V,
135 previousP.Parameter(),tolesp);
136 Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
137 previousP.Parameter(),tolesp);
138 // Indiquer que fin sur Bound.
139 }
140 else {
141 param = param + sens*stepw;
142 if (sens*(param - Bound) > - tolgui) {
143 param = Bound;
144 }
145 }
146
147 }
148 break;
149
150 case Blend_StepTooLarge :
151 {
152 stepw = stepw/2.;
153 if (Abs(stepw) < tolgui) {
154/*
155 Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
156 Extc.SetValue(previousP.PointOnC(),sol(3),sol(4),tolesp);
157*/
158 previousP.ParametersOnS(U,V);
159 Exts.SetValue(previousP.PointOnS(),U,V,
160 previousP.Parameter(),tolesp);
161 Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
162 previousP.Parameter(),tolesp);
163 Arrive = Standard_True;
164 if (line->NbPoints()>=2) {
165 // Indiquer qu on s arrete en cours de cheminement
166 }
167// else {
168// line->Clear();
169// }
170 }
171 else {
172 param = parprec + sens*stepw; // on ne risque pas de depasser Bound.
173 }
174 }
175 break;
176
177 case Blend_StepTooSmall :
178 {
179#ifdef DEB
180 if (Blend_GettraceDRAWSECT()){
181 Drawsect(surf,curv,param,Func);
182 }
183#endif
184 // Mettre a jour la ligne.
185 if (sens>0.) {
186 line->Append(previousP);
187 }
188 else {
189 line->Prepend(previousP);
190 }
191 parinit = sol;
192 parprec = param;
193
194 stepw = Min(1.5*stepw,pasmax);
195 if (param == Bound) {
196 Arrive = Standard_True;
197/*
198 Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
199 Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
200*/
201 previousP.ParametersOnS(U,V);
202 Exts.SetValue(previousP.PointOnS(),U,V,
203 previousP.Parameter(),tolesp);
204 Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
205 previousP.Parameter(),tolesp);
206 // Indiquer que fin sur Bound.
207 }
208 else {
209 param = param + sens*stepw;
210 if (sens*(param - Bound) > - tolgui) {
211 param = Bound;
212 }
213 }
214 }
215 break;
216
217 case Blend_OnRst1 :
218 {
219#ifdef DEB
220 if (Blend_GettraceDRAWSECT()){
221 Drawsect(surf,curv,param,Func);
222 }
223#endif
224 if (sens>0.) {
225 line->Append(previousP);
226 }
227 else {
228 line->Prepend(previousP);
229 }
230 MakeExtremity(Exts,Index,solrst(1),Isvtx,Vtx);
231// Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
232 Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
233 previousP.Parameter(),tolesp);
234 Arrive = Standard_True;
235 }
236 break;
237
238 case Blend_SamePoints :
239 {
240 // On arrete
241 cout << " Points confondus dans le cheminement" << endl;
242/*
243 Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
244 Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
245*/
246 previousP.ParametersOnS(U,V);
247 Exts.SetValue(previousP.PointOnS(),U,V,
248 previousP.Parameter(),tolesp);
249 Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
250 previousP.Parameter(),tolesp);
251 Arrive = Standard_True;
252 }
253 break;
254#ifndef DEB
255 default:
256 break;
257#endif
258 }
259 if (Arrive) {
260 if (sens > 0.) {
261 line->SetEndPoints(Exts,Extc);
262 }
263 else {
264 line->SetStartPoints(Exts,Extc);
265
266 }
267 }
268
269 }
270
271}
272
273
274