b311480e |
1 | // Created on: 1997-07-28 |
2 | // Created by: Jerome LEMONIER |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <BRepBlend_SurfRstEvolRad.ixx> |
24 | #include <math_Gauss.hxx> |
25 | #include <math_SVD.hxx> |
26 | |
27 | #include <ElCLib.hxx> |
28 | #include <gp.hxx> |
29 | #include <BlendFunc.hxx> |
30 | #include <GeomFill.hxx> |
31 | #include <TColStd_SequenceOfReal.hxx> |
32 | #include <Standard_DomainError.hxx> |
33 | #include <Standard_NotImplemented.hxx> |
34 | #include <Precision.hxx> |
35 | |
36 | #define Eps 1.e-15 |
37 | |
38 | static void t3dto2d(Standard_Real& a, |
39 | Standard_Real& b, |
40 | const gp_Vec& A, |
41 | const gp_Vec& B, |
42 | const gp_Vec& C) |
43 | { |
44 | Standard_Real AB = A.Dot(B); |
45 | Standard_Real AC = A.Dot(C); |
46 | Standard_Real BC = B.Dot(C); |
47 | Standard_Real BB = B.Dot(B); |
48 | Standard_Real CC = C.Dot(C); |
49 | Standard_Real deno = (BB*CC-BC*BC); |
50 | a = (AB*CC-AC*BC)/deno; |
51 | b = (AC*BB-AB*BC)/deno; |
52 | } |
53 | |
54 | static void FusionneIntervalles(const TColStd_Array1OfReal& I1, |
55 | const TColStd_Array1OfReal& I2, |
56 | TColStd_SequenceOfReal& Seq) |
57 | { |
58 | Standard_Integer ind1=1, ind2=1; |
59 | Standard_Real Epspar = Precision::PConfusion()*0.99; |
81bba717 |
60 | // it is supposed that positioning works with PConfusion()/2 |
7fd59977 |
61 | Standard_Real v1, v2; |
81bba717 |
62 | // Initialisation : IND1 and IND2 point at the first element |
63 | // of each of 2 tables to be processed. INDS points at the last |
64 | // element created by TABSOR |
7fd59977 |
65 | |
66 | |
81bba717 |
67 | //--- TABSOR is filled by parsing TABLE1 and TABLE2 simultaneously --- |
68 | //------------------ and eliminating multiple occurrencies ------------ |
7fd59977 |
69 | |
70 | while ((ind1<=I1.Upper()) && (ind2<=I2.Upper())) { |
71 | v1 = I1(ind1); |
72 | v2 = I2(ind2); |
73 | if (Abs(v1-v2)<= Epspar) { |
81bba717 |
74 | // Here the elements of I1 and I2 fit. |
7fd59977 |
75 | Seq.Append((v1+v2)/2); |
76 | ind1++; |
77 | ind2++; |
78 | } |
79 | else if (v1 < v2) { |
81bba717 |
80 | // Here the element of I1 fits. |
7fd59977 |
81 | Seq.Append(v1); |
82 | ind1++; |
83 | } |
84 | else { |
81bba717 |
85 | // Here the element of TABLE2 fits. |
7fd59977 |
86 | Seq.Append(v2); |
87 | ind2++; |
88 | } |
89 | } |
90 | |
91 | if (ind1>I1.Upper()) { |
81bba717 |
92 | //----- Here I1 is exhausted, completed with the end of TABLE2 ------- |
7fd59977 |
93 | |
94 | for (; ind2<=I2.Upper(); ind2++) { |
95 | Seq.Append(I2(ind2)); |
96 | } |
97 | } |
98 | |
99 | if (ind2>I2.Upper()) { |
81bba717 |
100 | //----- Here I2 is exhausted, completed with the end of I1 ------- |
7fd59977 |
101 | |
102 | for (; ind1<=I1.Upper(); ind1++) { |
103 | Seq.Append(I1(ind1)); |
104 | } |
105 | } |
106 | } |
107 | |
108 | //======================================================================= |
109 | //function : BRepBlend_SurfRstEvolRad |
81bba717 |
110 | //purpose : Contructor |
7fd59977 |
111 | //======================================================================= |
112 | BRepBlend_SurfRstEvolRad::BRepBlend_SurfRstEvolRad |
113 | (const Handle(Adaptor3d_HSurface)& Surf, |
114 | const Handle(Adaptor3d_HSurface)& SurfRst, |
115 | const Handle(Adaptor2d_HCurve2d)& Rst, |
116 | const Handle(Adaptor3d_HCurve)& CGuide, |
117 | const Handle(Law_Function)& Evol): |
118 | surf(Surf), surfrst(SurfRst), |
119 | rst(Rst), cons(Rst,SurfRst), |
120 | guide(CGuide), tguide(CGuide), |
121 | istangent(Standard_True), |
122 | maxang(RealFirst()), minang(RealLast()), |
123 | distmin(RealLast()), |
124 | mySShape(BlendFunc_Rational) |
125 | |
126 | { tevol=Evol; |
127 | fevol=Evol; |
128 | } |
129 | |
130 | //======================================================================= |
131 | //function : |
132 | //purpose : |
133 | //======================================================================= |
134 | Standard_Integer BRepBlend_SurfRstEvolRad::NbVariables() const |
135 | { |
136 | return 3; |
137 | } |
138 | |
139 | //======================================================================= |
140 | //function : |
141 | //purpose : |
142 | //======================================================================= |
143 | Standard_Integer BRepBlend_SurfRstEvolRad::NbEquations() const |
144 | { |
145 | return 3; |
146 | } |
147 | |
148 | //======================================================================= |
149 | //function : |
150 | //purpose : |
151 | //======================================================================= |
152 | Standard_Boolean BRepBlend_SurfRstEvolRad::Value |
153 | (const math_Vector& X, |
154 | math_Vector& F) |
155 | { |
156 | gp_Vec d1u1,d1v1,ns,vref; |
157 | Standard_Real norm; |
158 | |
159 | surf->D1(X(1),X(2),pts,d1u1,d1v1); |
160 | ptrst = cons.Value(X(3)); |
161 | |
162 | F(1) = nplan.XYZ().Dot(pts.XYZ()) + theD; |
163 | |
164 | F(2) = nplan.XYZ().Dot(ptrst.XYZ()) + theD; |
165 | |
166 | ns = d1u1.Crossed(d1v1); |
167 | norm = nplan.Crossed(ns).Magnitude(); |
168 | ns.SetLinearForm(nplan.Dot(ns)/norm,nplan, -1./norm,ns); |
169 | vref.SetLinearForm(ray,ns,gp_Vec(ptrst,pts)); |
170 | F(3) = vref.SquareMagnitude() - ray*ray; |
171 | return Standard_True; |
172 | } |
173 | |
174 | //======================================================================= |
175 | //function : Derivatives |
176 | //purpose : |
177 | //======================================================================= |
178 | Standard_Boolean BRepBlend_SurfRstEvolRad::Derivatives |
179 | (const math_Vector& X, |
180 | math_Matrix& D) |
181 | { gp_Vec d1u1,d1v1,d2u1,d2v1,d2uv1,d1; |
182 | gp_Vec ns,ncrossns,resul,temp, vref; |
183 | |
184 | Standard_Real norm,ndotns,grosterme; |
185 | |
186 | surf->D2(X(1),X(2),pts,d1u1,d1v1,d2u1,d2v1,d2uv1); |
187 | cons.D1(X(3),ptrst,d1); |
188 | |
189 | D(1,1) = nplan.Dot(d1u1); |
190 | D(1,2) = nplan.Dot(d1v1); |
191 | D(1,3) = 0.; |
192 | |
193 | D(2,1) = 0.; |
194 | D(2,2) = 0.; |
195 | D(2,3) = nplan.Dot(d1); |
196 | |
197 | |
198 | ns = d1u1.Crossed(d1v1); |
199 | ncrossns = nplan.Crossed(ns); |
200 | norm = ncrossns.Magnitude(); |
201 | ndotns = nplan.Dot(ns); |
202 | |
203 | vref.SetLinearForm(ndotns,nplan,-1.,ns); |
204 | vref.Divide(norm); |
205 | vref.SetLinearForm(ray,vref,gp_Vec(ptrst,pts)); |
206 | |
81bba717 |
207 | // Derivative corresponding to u1 |
7fd59977 |
208 | temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1)); |
209 | grosterme = ncrossns.Dot(nplan.Crossed(temp))/norm/norm; |
210 | resul.SetLinearForm(-ray/norm*(grosterme*ndotns-nplan.Dot(temp)),nplan, |
211 | ray*grosterme/norm,ns, |
212 | -ray/norm,temp, |
213 | d1u1); |
214 | |
215 | D(3,1) = 2.*(resul.Dot(vref)); |
216 | |
217 | |
81bba717 |
218 | // Derivative corresponding to v1 |
7fd59977 |
219 | temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1)); |
220 | grosterme = ncrossns.Dot(nplan.Crossed(temp))/norm/norm; |
221 | resul.SetLinearForm(-ray/norm*(grosterme*ndotns-nplan.Dot(temp)),nplan, |
222 | ray*grosterme/norm,ns, |
223 | -ray/norm,temp, |
224 | d1v1); |
225 | |
226 | D(3,2) = 2.*(resul.Dot(vref)); |
227 | |
228 | D(3,3) = -2.*(d1.Dot(vref)); |
229 | |
230 | return Standard_True; |
231 | |
232 | } |
233 | |
234 | //======================================================================= |
235 | //function : |
236 | //purpose : |
237 | //======================================================================= |
238 | Standard_Boolean BRepBlend_SurfRstEvolRad::Values |
239 | (const math_Vector& X, |
240 | math_Vector& F, |
241 | math_Matrix& D) |
242 | { |
243 | gp_Vec d1u1,d1v1,d1; |
244 | gp_Vec d2u1,d2v1,d2uv1; |
245 | gp_Vec ns,ncrossns,resul,temp,vref; |
246 | |
247 | Standard_Real norm,ndotns,grosterme; |
248 | |
249 | surf->D2(X(1),X(2),pts,d1u1,d1v1,d2u1,d2v1,d2uv1); |
250 | cons.D1(X(3),ptrst,d1); |
251 | |
252 | F(1) = nplan.XYZ().Dot(pts.XYZ()) + theD; |
253 | F(2) = nplan.XYZ().Dot(ptrst.XYZ()) + theD; |
254 | |
255 | D(1,1) = nplan.Dot(d1u1); |
256 | D(1,2) = nplan.Dot(d1v1); |
257 | D(1,3) = 0.; |
258 | |
259 | D(2,1) = 0.; |
260 | D(2,2) = 0.; |
261 | D(2,3) = nplan.Dot(d1); |
262 | |
263 | |
264 | ns = d1u1.Crossed(d1v1); |
265 | ncrossns = nplan.Crossed(ns); |
266 | norm = ncrossns.Magnitude(); |
267 | ndotns = nplan.Dot(ns); |
268 | |
269 | vref.SetLinearForm(ndotns,nplan,-1.,ns); |
270 | vref.Divide(norm); |
271 | vref.SetLinearForm(ray,vref,gp_Vec(ptrst,pts)); |
272 | |
273 | F(3) = vref.SquareMagnitude() - ray*ray; |
274 | |
275 | |
81bba717 |
276 | // Derivative corresponding to u1 |
7fd59977 |
277 | temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1)); |
278 | grosterme = ncrossns.Dot(nplan.Crossed(temp))/norm/norm; |
279 | resul.SetLinearForm(-ray/norm*(grosterme*ndotns-nplan.Dot(temp)),nplan, |
280 | ray*grosterme/norm,ns, |
281 | -ray/norm,temp, |
282 | d1u1); |
283 | |
284 | D(3,1) = 2.*(resul.Dot(vref)); |
285 | |
286 | |
81bba717 |
287 | // Derivative corresponding to v1 |
7fd59977 |
288 | temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1)); |
289 | grosterme = ncrossns.Dot(nplan.Crossed(temp))/norm/norm; |
290 | resul.SetLinearForm(-ray/norm*(grosterme*ndotns-nplan.Dot(temp)),nplan, |
291 | ray*grosterme/norm,ns, |
292 | -ray/norm,temp, |
293 | d1v1); |
294 | |
295 | D(3,2) = 2.*(resul.Dot(vref)); |
296 | |
297 | D(3,3) = -2.*(d1.Dot(vref)); |
298 | |
299 | return Standard_True; |
300 | } |
301 | |
302 | //======================================================================= |
303 | //function : |
304 | //purpose : |
305 | //======================================================================= |
306 | void BRepBlend_SurfRstEvolRad::Set |
307 | (const Handle(Adaptor3d_HSurface)& SurfRef, |
308 | const Handle(Adaptor2d_HCurve2d)& RstRef) |
309 | { |
310 | surfref = SurfRef; |
311 | rstref = RstRef; |
312 | } |
313 | |
314 | //======================================================================= |
315 | //function : |
316 | //purpose : |
317 | //======================================================================= |
318 | void BRepBlend_SurfRstEvolRad::Set(const Standard_Real Param) |
319 | { |
320 | d1gui = gp_Vec(0.,0.,0.); |
321 | nplan = gp_Vec(0.,0.,0.); |
322 | tguide->D2(Param,ptgui,d1gui,d2gui); |
323 | normtg = d1gui.Magnitude(); |
324 | nplan.SetXYZ(d1gui.Normalized().XYZ()); |
325 | gp_XYZ nplanXYZ(nplan.XYZ()); |
326 | gp_XYZ ptguiXYZ(ptgui.XYZ()); |
327 | theD = nplanXYZ.Dot(ptguiXYZ) ; |
328 | theD = theD * (-1.) ; |
329 | tevol->D1(Param,ray,dray); |
330 | ray=sg1*ray; |
331 | dray=sg1*dray; |
332 | } |
333 | |
334 | //======================================================================= |
335 | //function : |
81bba717 |
336 | //purpose : Segments the curve in its useful part. |
337 | // Precision is taken arbitrary small !? |
7fd59977 |
338 | //======================================================================= |
339 | void BRepBlend_SurfRstEvolRad::Set |
340 | (const Standard_Real First, |
341 | const Standard_Real Last) |
342 | { |
343 | tguide = guide->Trim(First,Last,1.e-12); |
344 | tevol = fevol->Trim(First,Last,1.e-12); |
345 | } |
346 | |
347 | //======================================================================= |
348 | //function : |
349 | //purpose : |
350 | //======================================================================= |
351 | void BRepBlend_SurfRstEvolRad::GetTolerance |
352 | (math_Vector& Tolerance, |
353 | const Standard_Real Tol) const |
354 | { |
355 | Tolerance(1) = surf->UResolution(Tol); |
356 | Tolerance(2) = surf->VResolution(Tol); |
357 | Tolerance(3) = cons.Resolution(Tol); |
358 | } |
359 | |
360 | //======================================================================= |
361 | //function : |
362 | //purpose : |
363 | //======================================================================= |
364 | void BRepBlend_SurfRstEvolRad::GetBounds |
365 | (math_Vector& InfBound, |
366 | math_Vector& SupBound) const |
367 | { |
368 | InfBound(1) = surf->FirstUParameter(); |
369 | InfBound(2) = surf->FirstVParameter(); |
370 | InfBound(3) = cons.FirstParameter(); |
371 | SupBound(1) = surf->LastUParameter(); |
372 | SupBound(2) = surf->LastVParameter(); |
373 | SupBound(3) = cons.LastParameter(); |
374 | |
375 | if(!Precision::IsInfinite(InfBound(1)) && |
376 | !Precision::IsInfinite(SupBound(1))) { |
377 | Standard_Real range = (SupBound(1) - InfBound(1)); |
378 | InfBound(1) -= range; |
379 | SupBound(1) += range; |
380 | } |
381 | if(!Precision::IsInfinite(InfBound(2)) && |
382 | !Precision::IsInfinite(SupBound(2))) { |
383 | Standard_Real range = (SupBound(2) - InfBound(2)); |
384 | InfBound(2) -= range; |
385 | SupBound(2) += range; |
386 | } |
387 | } |
388 | |
389 | //======================================================================= |
390 | //function : |
391 | //purpose : |
392 | //======================================================================= |
393 | Standard_Boolean BRepBlend_SurfRstEvolRad::IsSolution |
394 | (const math_Vector& Sol, |
395 | const Standard_Real Tol) |
396 | { |
397 | math_Vector valsol(1,3),secmember(1,3); |
398 | math_Matrix gradsol(1,3,1,3); |
399 | |
400 | gp_Vec dnplan,d1u1,d1v1,d1urst,d1vrst,d1,temp,ns,ns2,ncrossns,resul; |
401 | gp_Pnt bid; |
402 | Standard_Real norm,ndotns,grosterme; |
403 | Standard_Real Cosa,Sina,Angle; |
404 | |
405 | Values(Sol,valsol,gradsol); |
406 | if (Abs(valsol(1)) <= Tol && |
407 | Abs(valsol(2)) <= Tol && |
408 | Abs(valsol(3)) <= 2*Tol*Abs(ray) ) { |
409 | |
81bba717 |
410 | // Calculation of tangents |
7fd59977 |
411 | |
412 | pt2ds = gp_Pnt2d(Sol(1),Sol(2)); |
413 | prmrst = Sol(3); |
414 | pt2drst = rst->Value(prmrst); |
415 | surf->D1(Sol(1),Sol(2),pts,d1u1,d1v1); |
416 | cons.D1(Sol(3),ptrst,d1); |
417 | dnplan.SetLinearForm(1./normtg,d2gui, |
418 | -1./normtg*(nplan.Dot(d2gui)),nplan); |
419 | |
420 | temp.SetXYZ(pts.XYZ() - ptgui.XYZ()); |
421 | secmember(1) = normtg - dnplan.Dot(temp); |
422 | |
423 | temp.SetXYZ(ptrst.XYZ() - ptgui.XYZ()); |
424 | secmember(2) = normtg - dnplan.Dot(temp); |
425 | |
426 | ns = d1u1.Crossed(d1v1); |
427 | ncrossns = nplan.Crossed(ns); |
428 | ndotns = nplan.Dot(ns); |
429 | norm = ncrossns.Magnitude(); |
430 | |
431 | grosterme = ncrossns.Dot(dnplan.Crossed(ns))/norm/norm; |
432 | gp_Vec dnw; |
433 | dnw.SetLinearForm((dnplan.Dot(ns)-grosterme*ndotns)/norm,nplan, |
434 | ndotns/norm,dnplan, |
435 | grosterme/norm,ns); |
436 | |
437 | ns.SetLinearForm(ndotns/norm,nplan, -1./norm,ns); |
438 | resul.SetLinearForm(ray, ns, gp_Vec(ptrst,pts)); |
439 | |
440 | secmember(3) = -2.*ray*(dnw.Dot(resul)) - 2.*dray*(ns.Dot(resul)) + 2.*ray*dray; |
441 | math_Gauss Resol(gradsol); |
442 | if (Resol.IsDone()) { |
443 | Resol.Solve(secmember); |
444 | istangent = Standard_False; |
445 | } |
446 | else { |
447 | math_SVD SingRS (gradsol); |
448 | if (SingRS.IsDone()) { |
449 | math_Vector DEDT(1,3); |
450 | DEDT = secmember; |
451 | SingRS.Solve(DEDT, secmember, 1.e-6); |
452 | istangent = Standard_False; |
453 | } |
454 | else istangent = Standard_True; |
455 | } |
456 | |
457 | if (!istangent) { |
458 | tgs.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1); |
459 | tgrst = secmember(3)*d1; |
460 | tg2ds.SetCoord(secmember(1),secmember(2)); |
461 | surfrst->D1(pt2drst.X(),pt2drst.Y(),bid,d1urst,d1vrst); |
462 | Standard_Real a, b; |
463 | t3dto2d(a,b,tgrst,d1urst,d1vrst); |
464 | tg2drst.SetCoord(a,b); |
465 | istangent = Standard_False; |
466 | } |
467 | else { |
468 | istangent = Standard_True; |
469 | } |
81bba717 |
470 | // update of maxang |
7fd59977 |
471 | if(ray>0.) ns.Reverse(); |
472 | ns2 = -resul.Normalized(); |
473 | |
474 | Cosa = ns.Dot(ns2); |
475 | Sina = nplan.Dot(ns.Crossed(ns2)); |
476 | if (choix%2 != 0) { |
81bba717 |
477 | Sina = -Sina; //nplan is changed into -nplan |
7fd59977 |
478 | } |
479 | |
480 | Angle = ACos(Cosa); |
481 | if (Sina <0.) { |
c6541a0c |
482 | Angle = 2.*M_PI - Angle; |
7fd59977 |
483 | } |
484 | |
485 | if (Angle>maxang) {maxang = Angle;} |
486 | if (Angle<minang) {minang = Angle;} |
487 | distmin = Min( distmin, pts.Distance(ptrst)); |
488 | |
489 | return Standard_True; |
490 | } |
491 | istangent = Standard_True; |
492 | return Standard_False; |
493 | } |
494 | |
495 | |
496 | //======================================================================= |
497 | //function : GetMinimalDistance |
498 | //purpose : |
499 | //======================================================================= |
500 | |
501 | Standard_Real BRepBlend_SurfRstEvolRad::GetMinimalDistance() const |
502 | { |
503 | return distmin; |
504 | } |
505 | |
506 | //======================================================================= |
507 | //function : |
508 | //purpose : |
509 | //======================================================================= |
510 | const gp_Pnt& BRepBlend_SurfRstEvolRad::PointOnS() const |
511 | { |
512 | return pts; |
513 | } |
514 | |
515 | //======================================================================= |
516 | //function : |
517 | //purpose : |
518 | //======================================================================= |
519 | const gp_Pnt& BRepBlend_SurfRstEvolRad::PointOnRst() const |
520 | { |
521 | return ptrst ; |
522 | } |
523 | |
524 | //======================================================================= |
525 | //function : |
526 | //purpose : |
527 | //======================================================================= |
528 | const gp_Pnt2d& BRepBlend_SurfRstEvolRad::Pnt2dOnS() const |
529 | { |
530 | return pt2ds; |
531 | } |
532 | |
533 | //======================================================================= |
534 | //function : |
535 | //purpose : |
536 | //======================================================================= |
537 | const gp_Pnt2d& BRepBlend_SurfRstEvolRad::Pnt2dOnRst() const |
538 | { |
539 | return pt2drst; |
540 | } |
541 | |
542 | //======================================================================= |
543 | //function : |
544 | //purpose : |
545 | //======================================================================= |
546 | Standard_Real BRepBlend_SurfRstEvolRad::ParameterOnRst() const |
547 | { |
548 | return prmrst; |
549 | } |
550 | |
551 | //======================================================================= |
552 | //function : |
553 | //purpose : |
554 | //======================================================================= |
555 | Standard_Boolean BRepBlend_SurfRstEvolRad::IsTangencyPoint() const |
556 | { |
557 | return istangent; |
558 | } |
559 | |
560 | //======================================================================= |
561 | //function : |
562 | //purpose : |
563 | //======================================================================= |
564 | const gp_Vec& BRepBlend_SurfRstEvolRad::TangentOnS() const |
565 | { |
566 | if (istangent) {Standard_DomainError::Raise();} |
567 | return tgs; |
568 | } |
569 | |
570 | //======================================================================= |
571 | //function : |
572 | //purpose : |
573 | //======================================================================= |
574 | const gp_Vec2d& BRepBlend_SurfRstEvolRad::Tangent2dOnS() const |
575 | { |
576 | if (istangent) {Standard_DomainError::Raise();} |
577 | return tg2ds; |
578 | } |
579 | |
580 | //======================================================================= |
581 | //function : |
582 | //purpose : |
583 | //======================================================================= |
584 | const gp_Vec& BRepBlend_SurfRstEvolRad::TangentOnRst() const |
585 | { |
586 | if (istangent) {Standard_DomainError::Raise();} |
587 | return tgrst; |
588 | } |
589 | |
590 | //======================================================================= |
591 | //function : |
592 | //purpose : |
593 | //======================================================================= |
594 | const gp_Vec2d& BRepBlend_SurfRstEvolRad::Tangent2dOnRst() const |
595 | { |
596 | if (istangent) {Standard_DomainError::Raise();} |
597 | return tg2drst; |
598 | } |
599 | |
600 | //======================================================================= |
601 | //function : |
602 | //purpose : |
603 | //======================================================================= |
604 | Standard_Boolean BRepBlend_SurfRstEvolRad::Decroch |
605 | (const math_Vector& Sol, |
606 | gp_Vec& NS, |
607 | gp_Vec& TgS) const |
608 | { |
609 | gp_Vec TgRst, NRst, NRstInPlane, NSInPlane; |
610 | gp_Pnt bid,Center; |
611 | gp_Vec d1u,d1v; |
612 | Standard_Real norm,unsurnorm; |
613 | |
614 | surf->D1(Sol(1),Sol(2),bid,d1u,d1v); |
615 | NS = NSInPlane = d1u.Crossed(d1v); |
616 | |
617 | norm = nplan.Crossed(NS).Magnitude(); |
618 | unsurnorm = 1./norm; |
619 | NSInPlane.SetLinearForm(nplan.Dot(NS)*unsurnorm,nplan,-unsurnorm,NS); |
620 | |
621 | Center.SetXYZ(bid.XYZ()+ray*NSInPlane.XYZ()); |
622 | if(choix>2) NSInPlane.Reverse(); |
623 | TgS = nplan.Crossed(gp_Vec(Center,bid)); |
624 | if (choix%2 == 1) { |
625 | TgS.Reverse(); |
626 | } |
627 | Standard_Real u,v; |
628 | rstref->Value(Sol(3)).Coord(u,v); |
629 | surfref->D1(u,v,bid,d1u,d1v); |
630 | NRst = d1u.Crossed(d1v); |
631 | norm = nplan.Crossed(NRst).Magnitude(); |
632 | unsurnorm = 1./norm; |
633 | NRstInPlane.SetLinearForm(nplan.Dot(NRst)*unsurnorm,nplan,-unsurnorm,NRst); |
634 | gp_Vec centptrst(Center,bid); |
635 | if(centptrst.Dot(NRstInPlane) < 0.) NRstInPlane.Reverse(); |
636 | TgRst = nplan.Crossed(centptrst); |
637 | if (choix%2 == 1) { |
638 | TgRst.Reverse(); |
639 | } |
640 | |
641 | Standard_Real dot, NT = NRstInPlane.Magnitude(); |
642 | NT *= TgRst.Magnitude(); |
643 | if (Abs(NT) < 1.e-7) { |
81bba717 |
644 | return Standard_False; // Singularity or Incoherence. |
7fd59977 |
645 | } |
646 | dot = NRstInPlane.Dot(TgRst); |
647 | dot /= NT; |
648 | |
649 | return (dot < 1.e-10); |
650 | } |
651 | |
652 | //======================================================================= |
653 | //function : |
654 | //purpose : |
655 | //======================================================================= |
656 | void BRepBlend_SurfRstEvolRad::Set (const Standard_Integer Choix) |
657 | { |
658 | choix = Choix; |
659 | switch (choix) { |
660 | case 1 : |
661 | case 2 : |
662 | sg1 = -1; |
663 | break; |
664 | case 3 : |
665 | case 4 : |
666 | sg1 = 1; |
667 | break; |
668 | default : |
669 | sg1 = -1; |
670 | break; |
671 | } |
672 | } |
673 | |
674 | //======================================================================= |
675 | //function : |
676 | //purpose : |
677 | //======================================================================= |
678 | void BRepBlend_SurfRstEvolRad::Set(const BlendFunc_SectionShape TypeSection) |
679 | { |
680 | mySShape = TypeSection; |
681 | } |
682 | |
683 | //======================================================================= |
684 | //function : |
685 | //purpose : |
686 | //======================================================================= |
687 | void BRepBlend_SurfRstEvolRad::Section |
688 | (const Standard_Real Param, |
689 | const Standard_Real U, |
690 | const Standard_Real V, |
691 | const Standard_Real W, |
692 | Standard_Real& Pdeb, |
693 | Standard_Real& Pfin, |
694 | gp_Circ& C) |
695 | { |
696 | gp_Vec d1u1,d1v1; |
697 | gp_Vec ns, np; |
698 | Standard_Real norm; |
699 | gp_Pnt Center; |
700 | |
701 | tguide->D1(Param,ptgui,d1gui); |
702 | np = d1gui.Normalized(); |
703 | ray = sg1*tevol->Value(Param); |
704 | |
705 | surf->D1(U,V,pts,d1u1,d1v1); |
706 | ptrst = cons.Value(W); |
707 | |
708 | ns = d1u1.Crossed(d1v1); |
709 | |
710 | norm = nplan.Crossed(ns).Magnitude(); |
711 | ns.SetLinearForm(nplan.Dot(ns)/norm,nplan, -1./norm,ns); |
712 | Center.SetXYZ(pts.XYZ()+ray*ns.XYZ()); |
713 | C.SetRadius(Abs(ray)); |
714 | |
715 | if (ray > 0) { |
716 | ns.Reverse(); |
717 | } |
718 | if (choix%2 != 0) { |
719 | np.Reverse(); |
720 | } |
721 | C.SetPosition(gp_Ax2(Center,np,ns)); |
722 | |
723 | Pdeb = 0.; //ElCLib::Parameter(C,pts); |
724 | Pfin = ElCLib::Parameter(C,ptrst); |
725 | |
81bba717 |
726 | // Test negative and almost null angles : Single Case |
c6541a0c |
727 | if (Pfin>1.5*M_PI) { |
7fd59977 |
728 | np.Reverse(); |
729 | C.SetPosition(gp_Ax2(Center,np,ns)); |
730 | Pfin = ElCLib::Parameter(C,ptrst); |
731 | } |
732 | if (Pfin < Precision::PConfusion()) Pfin += Precision::PConfusion(); |
733 | } |
734 | |
735 | //======================================================================= |
736 | //function : |
737 | //purpose : |
738 | //======================================================================= |
739 | Standard_Boolean BRepBlend_SurfRstEvolRad::IsRational() const |
740 | { |
741 | return (mySShape==BlendFunc_Rational || mySShape==BlendFunc_QuasiAngular); |
742 | } |
743 | |
744 | //======================================================================= |
745 | //function : |
746 | //purpose : |
747 | //======================================================================= |
748 | Standard_Real BRepBlend_SurfRstEvolRad::GetSectionSize() const |
749 | { |
750 | return maxang*Abs(ray); |
751 | } |
752 | |
753 | //======================================================================= |
754 | //function : |
755 | //purpose : |
756 | //======================================================================= |
757 | void BRepBlend_SurfRstEvolRad::GetMinimalWeight(TColStd_Array1OfReal& Weigths) const |
758 | { |
759 | BlendFunc::GetMinimalWeights(mySShape, myTConv, minang, maxang, Weigths ); |
81bba717 |
760 | // It is supposed that it does not depend on the Radius! |
7fd59977 |
761 | } |
762 | |
763 | //======================================================================= |
764 | //function : |
765 | //purpose : |
766 | //======================================================================= |
767 | Standard_Integer BRepBlend_SurfRstEvolRad::NbIntervals(const GeomAbs_Shape S) const |
768 | { |
769 | Standard_Integer Nb_Int_Courbe, Nb_Int_Loi; |
770 | Nb_Int_Courbe = guide->NbIntervals(BlendFunc::NextShape(S)); |
771 | Nb_Int_Loi = fevol->NbIntervals(S); |
772 | |
773 | if (Nb_Int_Loi==1) { |
774 | return Nb_Int_Courbe; |
775 | } |
776 | |
777 | TColStd_Array1OfReal IntC(1, Nb_Int_Courbe+1); |
778 | TColStd_Array1OfReal IntL(1, Nb_Int_Loi+1); |
779 | TColStd_SequenceOfReal Inter; |
780 | guide->Intervals(IntC, BlendFunc::NextShape(S)); |
781 | fevol->Intervals(IntL, S); |
782 | |
783 | FusionneIntervalles( IntC, IntL, Inter); |
784 | return Inter.Length()-1; |
785 | } |
786 | |
787 | //======================================================================= |
788 | //function : |
789 | //purpose : |
790 | //======================================================================= |
791 | void BRepBlend_SurfRstEvolRad::Intervals(TColStd_Array1OfReal& T, |
792 | const GeomAbs_Shape S) const |
793 | { |
794 | Standard_Integer Nb_Int_Courbe, Nb_Int_Loi; |
795 | Nb_Int_Courbe = guide->NbIntervals(BlendFunc::NextShape(S)); |
796 | Nb_Int_Loi = fevol->NbIntervals(S); |
797 | |
798 | if (Nb_Int_Loi==1) { |
799 | guide->Intervals(T, BlendFunc::NextShape(S)); |
800 | } |
801 | else { |
802 | TColStd_Array1OfReal IntC(1, Nb_Int_Courbe+1); |
803 | TColStd_Array1OfReal IntL(1, Nb_Int_Loi+1); |
804 | TColStd_SequenceOfReal Inter; |
805 | guide->Intervals(IntC, BlendFunc::NextShape(S)); |
806 | fevol->Intervals(IntL, S); |
807 | |
808 | FusionneIntervalles( IntC, IntL, Inter); |
809 | for (Standard_Integer ii=1; ii<=Inter.Length(); ii++) { |
810 | T(ii) = Inter(ii); |
811 | } |
812 | } |
813 | } |
814 | |
815 | |
816 | //======================================================================= |
817 | //function : |
818 | //purpose : |
819 | //======================================================================= |
820 | void BRepBlend_SurfRstEvolRad::GetShape |
821 | (Standard_Integer& NbPoles, |
822 | Standard_Integer& NbKnots, |
823 | Standard_Integer& Degree, |
824 | Standard_Integer& NbPoles2d) |
825 | { |
826 | NbPoles2d = 2; |
827 | BlendFunc::GetShape(mySShape,maxang,NbPoles,NbKnots,Degree,myTConv); |
828 | } |
829 | |
830 | //======================================================================= |
831 | //function : |
832 | //purpose : |
833 | //======================================================================= |
834 | void BRepBlend_SurfRstEvolRad::GetTolerance |
835 | (const Standard_Real BoundTol, |
836 | const Standard_Real SurfTol, |
837 | const Standard_Real AngleTol, |
838 | math_Vector& Tol3d, |
839 | math_Vector& Tol1d) const |
840 | { |
841 | Standard_Integer low = Tol3d.Lower() , up=Tol3d.Upper(); |
842 | Standard_Real Tol; |
843 | Tol= GeomFill::GetTolerance(myTConv, minang, Abs(ray), |
844 | AngleTol, SurfTol); |
845 | Tol1d.Init(SurfTol); |
846 | Tol3d.Init(SurfTol); |
847 | Tol3d(low+1) = Tol3d(up-1) = Min( Tol, SurfTol); |
848 | Tol3d(low) = Tol3d(up) = Min( Tol, BoundTol); |
849 | } |
850 | |
851 | //======================================================================= |
852 | //function : |
853 | //purpose : |
854 | //======================================================================= |
855 | void BRepBlend_SurfRstEvolRad::Knots(TColStd_Array1OfReal& TKnots) |
856 | { |
857 | GeomFill::Knots(myTConv,TKnots); |
858 | } |
859 | |
860 | //======================================================================= |
861 | //function : |
862 | //purpose : |
863 | //======================================================================= |
864 | void BRepBlend_SurfRstEvolRad::Mults(TColStd_Array1OfInteger& TMults) |
865 | { |
866 | GeomFill::Mults(myTConv,TMults); |
867 | } |
868 | |
869 | //======================================================================= |
870 | //function : |
871 | //purpose : |
872 | //======================================================================= |
873 | Standard_Boolean BRepBlend_SurfRstEvolRad::Section |
874 | (const Blend_Point& P, |
875 | TColgp_Array1OfPnt& Poles, |
876 | TColgp_Array1OfVec& DPoles, |
877 | TColgp_Array1OfPnt2d& Poles2d, |
878 | TColgp_Array1OfVec2d& DPoles2d, |
879 | TColStd_Array1OfReal& Weigths, |
880 | TColStd_Array1OfReal& DWeigths) |
881 | { |
882 | |
883 | gp_Vec d1u1,d1v1,d2u1,d2v1,d2uv1,d1; |
884 | gp_Vec ns,ns2,dnplan,dnw,dn2w;//,np2,dnp2; |
885 | gp_Vec ncrossns;; |
886 | gp_Vec resulu,resulv,temp,tgct,resul; |
887 | gp_Vec d1urst,d1vrst; |
888 | gp_Pnt Center,bid; |
889 | |
890 | Standard_Real norm,ndotns,grosterme,dray; |
891 | |
892 | math_Vector sol(1,3),valsol(1,3),secmember(1,3); |
893 | math_Matrix gradsol(1,3,1,3); |
894 | |
895 | Standard_Real prm = P.Parameter(),rayprim; |
7fd59977 |
896 | Standard_Integer low = Poles.Lower(); |
897 | Standard_Integer upp = Poles.Upper(); |
898 | Standard_Boolean istgt; |
899 | |
900 | tguide->D2(prm,ptgui,d1gui,d2gui); |
901 | |
902 | tevol->D1(prm,ray,dray); |
903 | ray=sg1*ray; |
904 | dray=sg1*dray; |
905 | normtg = d1gui.Magnitude(); |
906 | nplan = d1gui.Normalized(); |
907 | dnplan.SetLinearForm(1./normtg,d2gui, |
908 | -1./normtg*(nplan.Dot(d2gui)),nplan); |
909 | |
910 | P.ParametersOnS(sol(1),sol(2)); |
911 | sol(3) = prmrst = P.ParameterOnC(); |
912 | pt2drst = rst->Value(prmrst); |
913 | |
914 | Values(sol,valsol,gradsol); |
915 | |
916 | surf->D2(sol(1),sol(2),pts,d1u1,d1v1,d2u1,d2v1,d2uv1); |
917 | cons.D1(sol(3),ptrst,d1); |
918 | |
919 | temp.SetXYZ(pts.XYZ()- ptgui.XYZ()); |
920 | secmember(1) = normtg - dnplan.Dot(temp); |
921 | |
922 | temp.SetXYZ(ptrst.XYZ()- ptgui.XYZ()); |
923 | secmember(2) = normtg - dnplan.Dot(temp); |
924 | |
925 | ns = d1u1.Crossed(d1v1); |
926 | ncrossns = nplan.Crossed(ns); |
927 | ndotns = nplan.Dot(ns); |
928 | norm = ncrossns.Magnitude(); |
929 | if (norm < Eps) { |
81bba717 |
930 | norm = 1; // Not enough, but it is not necessary to stop |
7fd59977 |
931 | #if DEB |
81bba717 |
932 | cout << " SurfRstEvolRad : Surface single " << endl; |
7fd59977 |
933 | #endif |
934 | } |
935 | |
81bba717 |
936 | // Derivative of n1 corresponding to w |
7fd59977 |
937 | |
938 | grosterme = ncrossns.Dot(dnplan.Crossed(ns))/norm/norm; |
939 | dnw.SetLinearForm((dnplan.Dot(ns)-grosterme*ndotns)/norm,nplan, |
940 | ndotns/norm,dnplan, |
941 | grosterme/norm,ns); |
942 | |
943 | temp.SetLinearForm(ndotns/norm,nplan, -1./norm,ns); |
944 | resul.SetLinearForm(ray,temp,gp_Vec(ptrst,pts)); |
945 | |
946 | //secmember(3) = -2.*ray*(dnw.Dot(resul)); // jag 950105 il manquait ray |
947 | secmember(3) = -2.*ray*(dnw.Dot(resul)) - 2.*dray*(temp.Dot(resul)) + 2.*ray*dray; |
948 | math_Gauss Resol(gradsol); |
949 | |
950 | if (Resol.IsDone()) { |
951 | Resol.Solve(secmember); |
952 | istgt = Standard_False; |
953 | } |
954 | else { |
955 | math_SVD SingRS (gradsol); |
956 | if (SingRS.IsDone()) { |
957 | math_Vector DEDT(1,3); |
958 | DEDT = secmember; |
959 | SingRS.Solve(DEDT, secmember, 1.e-6); |
960 | istgt = Standard_False; |
961 | } |
962 | else istgt = Standard_True; |
963 | } |
964 | |
965 | if (!istgt) { |
966 | |
967 | tgs.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1); |
968 | tgrst = secmember(3)*d1; |
81bba717 |
969 | // Derivative of n1 corresponding to u1 |
7fd59977 |
970 | temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1)); |
971 | grosterme = ncrossns.Dot(nplan.Crossed(temp))/norm/norm; |
972 | resulu.SetLinearForm(-(grosterme*ndotns-nplan.Dot(temp))/norm,nplan, |
973 | grosterme/norm,ns, |
974 | -1./norm,temp); |
975 | |
81bba717 |
976 | // Derivative of n1 corresponding to v1 |
7fd59977 |
977 | temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1)); |
978 | grosterme = ncrossns.Dot(nplan.Crossed(temp))/norm/norm; |
979 | resulv.SetLinearForm(-(grosterme*ndotns-nplan.Dot(temp))/norm,nplan, |
980 | grosterme/norm,ns, |
981 | -1./norm,temp); |
982 | |
983 | |
984 | dnw.SetLinearForm(secmember(1),resulu,secmember(2),resulv,dnw); |
985 | ns.SetLinearForm(ndotns/norm,nplan, -1./norm,ns); |
986 | |
987 | dn2w.SetLinearForm(ray, dnw, -1., tgrst, tgs); |
988 | dn2w.SetLinearForm(dray,ns,dn2w); |
989 | norm = resul.Magnitude(); |
990 | dn2w.Divide(norm); |
991 | ns2 = -resul.Normalized(); |
992 | dn2w.SetLinearForm(ns2.Dot(dn2w),ns2,-1.,dn2w); |
993 | |
994 | istgt = Standard_False; |
995 | } |
996 | else { |
997 | ns.SetLinearForm(ndotns/norm,nplan, -1./norm,ns); |
998 | ns2 = -resul.Normalized(); |
999 | istgt = Standard_True; |
1000 | } |
1001 | |
81bba717 |
1002 | // Tops 2D |
7fd59977 |
1003 | |
1004 | Poles2d(Poles2d.Lower()).SetCoord(sol(1),sol(2)); |
1005 | Poles2d(Poles2d.Upper()).SetCoord(pt2drst.X(),pt2drst.Y()); |
1006 | if (!istgt) { |
1007 | DPoles2d(Poles2d.Lower()).SetCoord(secmember(1),secmember(2)); |
1008 | surfrst->D1(pt2drst.X(),pt2drst.Y(),bid,d1urst,d1vrst); |
1009 | Standard_Real a, b; |
1010 | t3dto2d(a,b,tgrst,d1urst,d1vrst); |
1011 | DPoles2d(Poles2d.Upper()).SetCoord(a,b); |
1012 | } |
1013 | |
81bba717 |
1014 | // Linear Case |
7fd59977 |
1015 | if (mySShape == BlendFunc_Linear) { |
1016 | Poles(low) = pts; |
1017 | Poles(upp) = ptrst; |
1018 | Weigths(low) = 1.0; |
1019 | Weigths(upp) = 1.0; |
1020 | if (!istgt) { |
1021 | DPoles(low) = tgs; |
1022 | DPoles(upp) = tgrst; |
1023 | DWeigths(low) = 0.0; |
1024 | DWeigths(upp) = 0.0; |
1025 | } |
1026 | return (!istgt); |
1027 | } |
1028 | |
81bba717 |
1029 | // Case of the circle |
7fd59977 |
1030 | Center.SetXYZ(pts.XYZ()+ray*ns.XYZ()); |
1031 | if (!istgt) { |
1032 | tgct.SetLinearForm(ray,dnw,dray,ns,tgs); |
1033 | } |
1034 | |
1035 | if (ray > 0.) { |
1036 | ns.Reverse(); |
1037 | if (!istgt) { |
1038 | dnw.Reverse(); |
1039 | } |
1040 | } |
1041 | if (choix%2 != 0) { |
1042 | nplan.Reverse(); |
1043 | dnplan.Reverse(); |
1044 | } |
1045 | if (!istgt) { |
81bba717 |
1046 | if (ray < 0.) { // to avoid Abs(dray) some lines below |
7fd59977 |
1047 | rayprim = -dray; |
1048 | } |
1049 | else rayprim = dray; |
1050 | |
1051 | return GeomFill::GetCircle(myTConv, |
1052 | ns, ns2, |
1053 | dnw, dn2w, |
1054 | nplan, dnplan, |
1055 | pts, ptrst, |
1056 | tgs, tgrst, |
1057 | Abs(ray),rayprim , |
1058 | Center, tgct, |
1059 | Poles, |
1060 | DPoles, |
1061 | Weigths, |
1062 | DWeigths); |
1063 | } |
1064 | else { |
1065 | GeomFill::GetCircle(myTConv, |
1066 | ns, ns2, |
1067 | nplan, pts, ptrst, |
1068 | Abs(ray), Center, |
1069 | Poles, Weigths); |
1070 | return Standard_False; |
1071 | } |
1072 | } |
1073 | |
1074 | //======================================================================= |
1075 | //function : |
1076 | //purpose : |
1077 | //======================================================================= |
35e08fe8 |
1078 | Standard_Boolean BRepBlend_SurfRstEvolRad::Section (const Blend_Point& /*P*/, |
1079 | TColgp_Array1OfPnt& /*Poles*/, |
1080 | TColgp_Array1OfVec& /*DPoles*/, |
1081 | TColgp_Array1OfVec& /*D2Poles*/, |
1082 | TColgp_Array1OfPnt2d& /*Poles2d*/, |
1083 | TColgp_Array1OfVec2d& /*DPoles2d*/, |
1084 | TColgp_Array1OfVec2d& /*D2Poles2d*/, |
1085 | TColStd_Array1OfReal& /*Weigths*/, |
1086 | TColStd_Array1OfReal& /*DWeigths*/, |
1087 | TColStd_Array1OfReal& /*D2Weigths*/) |
7fd59977 |
1088 | { |
1089 | return Standard_False; |
1090 | } |
1091 | |
1092 | //======================================================================= |
1093 | //function : |
1094 | //purpose : |
1095 | //======================================================================= |
1096 | void BRepBlend_SurfRstEvolRad::Section |
1097 | (const Blend_Point& P, |
1098 | TColgp_Array1OfPnt& Poles, |
1099 | TColgp_Array1OfPnt2d& Poles2d, |
1100 | TColStd_Array1OfReal& Weigths) |
1101 | { |
1102 | gp_Vec d1u1,d1v1;//,d1; |
1103 | gp_Vec ns,ns2;//,temp,np2; |
1104 | gp_Pnt Center; |
1105 | |
1106 | Standard_Real norm,u1,v1,w; |
1107 | |
1108 | Standard_Real prm = P.Parameter(); |
1109 | Standard_Integer low = Poles.Lower(); |
1110 | Standard_Integer upp = Poles.Upper(); |
1111 | |
1112 | tguide->D1(prm,ptgui,d1gui); |
1113 | ray = tevol->Value(prm); |
1114 | ray=sg1*ray; |
1115 | nplan = d1gui.Normalized(); |
1116 | |
1117 | P.ParametersOnS(u1,v1); |
81bba717 |
1118 | w = P.ParameterOnC(); //jlr : point on curve not on surface |
7fd59977 |
1119 | gp_Pnt2d pt2d = rst->Value(w); |
1120 | |
1121 | surf->D1(u1,v1,pts,d1u1,d1v1); |
1122 | ptrst = cons.Value(w); |
1123 | |
1124 | distmin = Min (distmin, pts.Distance(ptrst)); |
1125 | |
1126 | Poles2d(Poles2d.Lower()).SetCoord(u1,v1); |
1127 | Poles2d(Poles2d.Upper()).SetCoord(pt2d.X(),pt2d.Y()); |
1128 | |
81bba717 |
1129 | // Linear case |
7fd59977 |
1130 | if (mySShape == BlendFunc_Linear) { |
1131 | Poles(low) = pts; |
1132 | Poles(upp) = ptrst; |
1133 | Weigths(low) = 1.0; |
1134 | Weigths(upp) = 1.0; |
1135 | return; |
1136 | } |
1137 | |
1138 | ns = d1u1.Crossed(d1v1); |
1139 | norm = nplan.Crossed(ns).Magnitude(); |
1140 | |
1141 | ns.SetLinearForm(nplan.Dot(ns)/norm,nplan, -1./norm,ns); |
1142 | |
1143 | Center.SetXYZ(pts.XYZ()+ray*ns.XYZ()); |
1144 | |
1145 | ns2 = gp_Vec(Center,ptrst).Normalized(); |
1146 | if(ray>0) ns.Reverse(); |
1147 | if (choix%2 != 0) { |
1148 | nplan.Reverse(); |
1149 | } |
1150 | |
1151 | GeomFill::GetCircle(myTConv, |
1152 | ns, ns2, |
1153 | nplan, pts, ptrst, |
1154 | Abs(ray), Center, |
1155 | Poles, Weigths); |
1156 | } |
1157 | |
1158 | void BRepBlend_SurfRstEvolRad::Resolution(const Standard_Integer IC2d, |
1159 | const Standard_Real Tol, |
1160 | Standard_Real& TolU, |
1161 | Standard_Real& TolV) const |
1162 | { |
1163 | if(IC2d == 1){ |
1164 | TolU = surf->UResolution(Tol); |
1165 | TolV = surf->VResolution(Tol); |
1166 | } |
1167 | else { |
1168 | TolU = surfrst->UResolution(Tol); |
1169 | TolV = surfrst->VResolution(Tol); |
1170 | } |
1171 | } |
1172 | |
1173 | |