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