1 // Created on: 1995-10-19
2 // Created by: Andre LIEUTIER
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // 26-Mar-96 : xab : inclusion des inlines trop gros
18 // 15-Oct-96 : alr : extraction des inlines (pas tous ceux inclus par xab)
19 // 19-Fev-97 : jct : ajout des methodes UVBox et UVConstraints (G1134)
20 // 10-Dec-97 : jag : Gros debug sur delete, et sur la methode Copy...
21 // 13-Jan-98 : alr : ajout des derivees pour contraintes G3 et approx. C2
22 // 28-Avr-98 : alr : Prise en compte des Linear*Constraint, methodes SolveTI1,SolveTI2,SolveTI3
26 #include <math_Gauss.hxx>
27 #include <math_Matrix.hxx>
28 #include <math_Vector.hxx>
29 #include <Plate_FreeGtoCConstraint.hxx>
30 #include <Plate_GlobalTranslationConstraint.hxx>
31 #include <Plate_GtoCConstraint.hxx>
32 #include <Plate_LinearScalarConstraint.hxx>
33 #include <Plate_LinearXYZConstraint.hxx>
34 #include <Plate_LineConstraint.hxx>
35 #include <Plate_PinpointConstraint.hxx>
36 #include <Plate_PlaneConstraint.hxx>
37 #include <Plate_Plate.hxx>
38 #include <Plate_SampledCurveConstraint.hxx>
39 #include <Standard_ErrorHandler.hxx>
41 //=======================================================================
42 //function : Plate_Plate
44 //=======================================================================
45 Plate_Plate::Plate_Plate()
46 : order(0), n_el(0), n_dim(0),
47 solution(0),points(0),deru(0),derv(0),
48 OK(Standard_False),maxConstraintOrder(0),
55 PolynomialPartOnly = Standard_False;
58 //=======================================================================
59 //function : Plate_Plate
61 //=======================================================================
63 Plate_Plate::Plate_Plate(const Plate_Plate& Ref)
64 : order(Ref.order),n_el(Ref.n_el),n_dim(Ref.n_dim),
65 solution(0),points(0),deru(0),derv(0),
75 if (n_dim >0 && Ref.solution != 0) {
76 solution = new gp_XYZ[n_dim];
77 for(i=0; i<n_dim ;i++) {
78 Solution(i) = Ref.Solution(i);
83 if (Ref.points != 0) {
84 points = new gp_XY[n_el];
85 for(i=0; i<n_el;i++) {
86 Points(i) = Ref.Points(i);
91 deru = new Standard_Integer[n_el] ;
92 for (i = 0 ; i < n_el ; i++) {
93 Deru(i) = Ref.Deru(i);
98 derv = new Standard_Integer[n_el] ;
99 for (i = 0 ; i < n_el ; i++) {
100 Derv(i) = Ref.Derv(i);
106 myConstraints = Ref.myConstraints;
107 myLXYZConstraints = Ref.myLXYZConstraints;
108 myLScalarConstraints = Ref.myLScalarConstraints;
109 maxConstraintOrder = Ref.maxConstraintOrder;
110 PolynomialPartOnly = Ref.PolynomialPartOnly;
111 for (i=0; i<10;i++) {
116 //=======================================================================
119 //=======================================================================
120 Plate_Plate& Plate_Plate::Copy(const Plate_Plate& Ref)
129 if (n_dim >0 && Ref.solution != 0) {
130 solution = new gp_XYZ[n_dim];
131 for(i=0; i<n_dim ;i++) {
132 Solution(i) = Ref.Solution(i);
137 if (Ref.points != 0) {
138 points = new gp_XY[n_el];
139 for(i=0; i<n_el;i++) {
140 Points(i) = Ref.Points(i);
145 deru = new Standard_Integer[n_el] ;
146 for (i = 0 ; i < n_el ; i++) {
147 Deru(i) = Ref.Deru(i);
152 derv = new Standard_Integer[n_el] ;
153 for (i = 0 ; i < n_el ; i++) {
154 Derv(i) = Ref.Derv(i);
160 myConstraints = Ref.myConstraints;
161 myLXYZConstraints = Ref.myLXYZConstraints;
162 myLScalarConstraints = Ref.myLScalarConstraints;
163 maxConstraintOrder = Ref.maxConstraintOrder;
164 PolynomialPartOnly = Ref.PolynomialPartOnly;
166 for (i=0; i<10;i++) {
172 //=======================================================================
175 //=======================================================================
177 void Plate_Plate::Load(const Plate_PinpointConstraint& PConst)
181 myConstraints.Append(PConst);
182 Standard_Integer OrdreConst = PConst.Idu() + PConst.Idv();
183 if(maxConstraintOrder<OrdreConst) maxConstraintOrder = OrdreConst;
186 void Plate_Plate::Load(const Plate_LinearXYZConstraint& LXYZConst)
189 n_el += LXYZConst.Coeff().RowLength();
191 myLXYZConstraints.Append(LXYZConst);
192 for(Standard_Integer j=1;j <= LXYZConst.GetPPC().Length() ; j++)
194 Standard_Integer OrdreConst = LXYZConst.GetPPC()(j).Idu() + LXYZConst.GetPPC()(j).Idv();
195 if(maxConstraintOrder<OrdreConst) maxConstraintOrder = OrdreConst;
199 void Plate_Plate::Load(const Plate_LinearScalarConstraint& LScalarConst)
202 n_el += LScalarConst.Coeff().RowLength();
203 myLScalarConstraints.Append(LScalarConst);
204 for(Standard_Integer j=1;j <= LScalarConst.GetPPC().Length() ; j++)
206 Standard_Integer OrdreConst = LScalarConst.GetPPC()(j).Idu() + LScalarConst.GetPPC()(j).Idv();
207 if(maxConstraintOrder<OrdreConst) maxConstraintOrder = OrdreConst;
211 void Plate_Plate::Load(const Plate_LineConstraint& LConst)
216 void Plate_Plate::Load(const Plate_PlaneConstraint& PConst)
221 void Plate_Plate::Load(const Plate_SampledCurveConstraint& SCConst)
223 Load(SCConst.LXYZC());
226 void Plate_Plate::Load(const Plate_GtoCConstraint& GtoCConst)
228 for(Standard_Integer i=0;i< GtoCConst.nb_PPC();i++)
229 Load(GtoCConst.GetPPC(i));
232 void Plate_Plate::Load(const Plate_FreeGtoCConstraint& FGtoCConst)
235 for( i=0;i< FGtoCConst.nb_PPC();i++)
236 Load(FGtoCConst.GetPPC(i));
237 for(i=0;i< FGtoCConst.nb_LSC();i++)
238 Load(FGtoCConst.LSC(i));
241 void Plate_Plate::Load(const Plate_GlobalTranslationConstraint& GTConst)
243 Load(GTConst.LXYZC());
246 //=======================================================================
248 //purpose : to solve the set of constraints
249 //=======================================================================
251 void Plate_Plate::SolveTI(const Standard_Integer ord,
252 const Standard_Real anisotropie)
254 Standard_Integer IterationNumber=0;
260 if(anisotropie < 1.e-6) return;
261 if(anisotropie > 1.e+6) return;
263 // computation of the bounding box of the 2d PPconstraints
264 Standard_Real xmin,xmax,ymin,ymax;
265 UVBox(xmin,xmax,ymin,ymax);
267 Standard_Real du = 0.5*(xmax - xmin);
268 if(anisotropie >1.) du *= anisotropie;
269 if(du < 1.e-10) return;
272 for( i=1;i<=9;i++) ddu[i] = ddu[i-1] / du;
274 Standard_Real dv = 0.5*(ymax - ymin);
275 if(anisotropie <1.) dv /= anisotropie;
276 if(dv < 1.e-10) return;
278 for(i=1;i<=9;i++) ddv[i] = ddv[i-1] / dv;
281 if(myLScalarConstraints.IsEmpty())
283 if(myLXYZConstraints.IsEmpty())
284 SolveTI1(IterationNumber);
286 SolveTI2(IterationNumber);
289 SolveTI3(IterationNumber);
293 //=======================================================================
294 //function : SolveTI1
295 //purpose : to solve the set of constraints in the easiest case,
296 // only PinPointConstraints are loaded
297 //=======================================================================
299 void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber)
301 // computation of square matrix members
304 n_dim = n_el + order*(order+1)/2;
305 math_Matrix mat(0, n_dim-1, 0, n_dim-1, 0.);
307 delete [] (gp_XY*)points;
308 points = new gp_XY[n_el];
310 for( i=0; i<n_el;i++) Points(i) = myConstraints(i+1).Pnt2d();
312 delete [] (Standard_Integer*)deru;
313 deru = new Standard_Integer[n_el];
314 for(i=0; i<n_el;i++) Deru(i) = myConstraints(i+1).Idu();
316 delete [] (Standard_Integer*)derv;
317 derv = new Standard_Integer[n_el];
318 for(i=0; i<n_el;i++) Derv(i) = myConstraints(i+1).Idv();
320 for(i=0; i<n_el;i++) {
321 for(Standard_Integer j=0;j<i;j++) {
322 Standard_Real signe = 1;
323 if ( ((Deru(j)+Derv(j))%2) == 1) signe = -1;
324 Standard_Integer iu = Deru(i) + Deru(j);
325 Standard_Integer iv = Derv(i) + Derv(j);
326 mat(i,j) = signe * SolEm(Points(i) - Points(j),iu,iv);
331 for(Standard_Integer iu = 0; iu< order; iu++) {
332 for(Standard_Integer iv =0; iu+iv < order; iv++) {
333 for(Standard_Integer j=0;j<n_el;j++) {
334 Standard_Integer idu = Deru(j);
335 Standard_Integer idv = Derv(j);
336 mat(i,j) = Polm (Points(j), iu, iv, idu, idv);
342 for(i=0;i<n_dim;i++) {
343 for(Standard_Integer j = i+1; j<n_dim;j++) {
348 // initialisation of the Gauss algorithm
349 Standard_Real pivot_max = 1.e-12;
352 math_Gauss algo_gauss(mat,pivot_max);
353 if(!algo_gauss.IsDone()) {
354 Standard_Integer nbm = order*(order+1)/2;
355 for(i=n_el;i<n_el+nbm;i++) {
359 math_Gauss thealgo(mat,pivot_max);
360 algo_gauss = thealgo;
361 OK = algo_gauss.IsDone();
365 // computation of the linear system solution for the X, Y and Z coordinates
366 math_Vector sec_member( 0, n_dim-1, 0.);
367 math_Vector sol(0,n_dim-1);
369 delete [] (gp_XYZ*) solution;
370 solution = new gp_XYZ[n_dim];
372 for(Standard_Integer icoor=1; icoor<=3;icoor++) {
373 for(i=0;i<n_el;i++) {
374 sec_member(i) = myConstraints(i+1).Value().Coord(icoor);
376 algo_gauss.Solve(sec_member, sol);
377 //alr iteration pour affiner la solution
379 math_Vector sol1(0,n_dim-1);
380 math_Vector sec_member1(0,n_dim-1);
381 for(i=1;i<=IterationNumber;i++)
383 sec_member1 = sec_member - mat*sol;
384 algo_gauss.Solve(sec_member1, sol1);
390 for(i=0;i<n_dim;i++) {
391 Solution(i).SetCoord (icoor, sol(i));
397 //=======================================================================
398 //function : SolveTI2
399 //purpose : to solve the set of constraints in the medium case,
400 // LinearXYZ constraints are provided but no LinearScalar one
401 //=======================================================================
403 void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber)
405 // computation of square matrix members
407 Standard_Integer nCC1 = myConstraints.Length();
408 Standard_Integer nCC2 = 0;
410 for( i = 1; i<= myLXYZConstraints.Length(); i++)
411 nCC2 += myLXYZConstraints(i).Coeff().ColLength();
413 Standard_Integer n_dimat = nCC1 + nCC2 + order*(order+1)/2;
416 delete [] (gp_XY*)points;
417 points = new gp_XY[n_el];
418 delete [] (Standard_Integer*)deru;
419 deru = new Standard_Integer[n_el];
420 delete [] (Standard_Integer*)derv;
421 derv = new Standard_Integer[n_el];
424 for(i=0; i< nCC1;i++)
426 Points(i) = myConstraints(i+1).Pnt2d();
427 Deru(i) = myConstraints(i+1).Idu();
428 Derv(i) = myConstraints(i+1).Idv();
431 Standard_Integer k = nCC1;
432 for( i = 1; i<= myLXYZConstraints.Length(); i++)
433 for(Standard_Integer j=1;j <= myLXYZConstraints(i).GetPPC().Length() ; j++)
435 Points(k) = myLXYZConstraints(i).GetPPC()(j).Pnt2d();
436 Deru(k) = myLXYZConstraints(i).GetPPC()(j).Idu();
437 Derv(k) = myLXYZConstraints(i).GetPPC()(j).Idv();
441 math_Matrix mat(0, n_dimat-1, 0, n_dimat-1, 0.);
443 fillXYZmatrix(mat,0,0,nCC1,nCC2);
446 // initialisation of the Gauss algorithm
447 Standard_Real pivot_max = 1.e-12;
448 OK = Standard_True; // ************ JHH
450 math_Gauss algo_gauss(mat,pivot_max);
451 if(!algo_gauss.IsDone()) {
452 for(i=nCC1+nCC2;i<n_dimat;i++) {
456 math_Gauss thealgo1(mat,pivot_max);
457 algo_gauss = thealgo1;
458 OK = algo_gauss.IsDone();
462 // computation of the linear system solution for the X, Y and Z coordinates
463 math_Vector sec_member( 0, n_dimat-1, 0.);
464 math_Vector sol(0,n_dimat-1);
466 delete [] (gp_XYZ*) solution;
467 n_dim = n_el+order*(order+1)/2;
468 solution = new gp_XYZ[n_dim];
470 for(Standard_Integer icoor=1; icoor<=3;icoor++) {
471 for(i=0;i<nCC1;i++) {
472 sec_member(i) = myConstraints(i+1).Value().Coord(icoor);
476 for(i = 1; i<= myLXYZConstraints.Length(); i++) {
477 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++) {
478 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++)
479 sec_member(k) += myLXYZConstraints(i).Coeff()(irow,icol)
480 * myLXYZConstraints(i).GetPPC()(icol).Value().Coord(icoor);
485 algo_gauss.Solve(sec_member, sol);
486 //alr iteration pour affiner la solution
488 math_Vector sol1(0,n_dimat-1);
489 math_Vector sec_member1(0,n_dimat-1);
490 for(i=1;i<=IterationNumber;i++)
492 sec_member1 = sec_member - mat*sol;
493 algo_gauss.Solve(sec_member1, sol1);
499 for(i=0;i<nCC1;i++) Solution(i).SetCoord (icoor, sol(i));
501 Standard_Integer kSolution = nCC1;
502 Standard_Integer ksol = nCC1;
504 for(i = 1; i<= myLXYZConstraints.Length(); i++) {
505 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++){
506 Standard_Real vsol = 0;
507 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++)
508 vsol += myLXYZConstraints(i).Coeff()(irow,icol)*sol(ksol+irow-1);
509 Solution(kSolution).SetCoord (icoor, vsol);
512 ksol += myLXYZConstraints(i).Coeff().ColLength();
515 for(i=0;i<order*(order+1)/2; i++) {
516 Solution(n_el+i).SetCoord (icoor, sol(ksol+i));
522 //=======================================================================
523 //function : SolveTI3
524 //purpose : to solve the set of constraints in the most general situation
525 //=======================================================================
527 void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber)
529 // computation of square matrix members
531 Standard_Integer nCC1 = myConstraints.Length();
533 Standard_Integer nCC2 = 0;
535 for( i = 1; i<= myLXYZConstraints.Length(); i++)
536 nCC2 += myLXYZConstraints(i).Coeff().ColLength();
538 Standard_Integer nCC3 = 0;
539 for(i = 1; i<= myLScalarConstraints.Length(); i++)
540 nCC3 += myLScalarConstraints(i).Coeff().ColLength();
542 Standard_Integer nbm = order*(order+1)/2;
543 Standard_Integer n_dimsousmat = nCC1 + nCC2 + nbm ;
544 Standard_Integer n_dimat =3*n_dimsousmat + nCC3;
547 delete [] (gp_XY*)points;
548 points = new gp_XY[n_el];
549 delete [] (Standard_Integer*)deru;
550 deru = new Standard_Integer[n_el];
551 delete [] (Standard_Integer*)derv;
552 derv = new Standard_Integer[n_el];
555 for(i=0; i< nCC1;i++)
557 Points(i) = myConstraints(i+1).Pnt2d();
558 Deru(i) = myConstraints(i+1).Idu();
559 Derv(i) = myConstraints(i+1).Idv();
562 Standard_Integer k = nCC1;
563 for(i = 1; i<= myLXYZConstraints.Length(); i++)
564 for(Standard_Integer j=1;j <= myLXYZConstraints(i).GetPPC().Length() ; j++)
566 Points(k) = myLXYZConstraints(i).GetPPC()(j).Pnt2d();
567 Deru(k) = myLXYZConstraints(i).GetPPC()(j).Idu();
568 Derv(k) = myLXYZConstraints(i).GetPPC()(j).Idv();
571 Standard_Integer nPPC2 = k;
572 for(i = 1; i<= myLScalarConstraints.Length(); i++)
573 for(Standard_Integer j=1;j <= myLScalarConstraints(i).GetPPC().Length() ; j++)
575 Points(k) = myLScalarConstraints(i).GetPPC()(j).Pnt2d();
576 Deru(k) = myLScalarConstraints(i).GetPPC()(j).Idu();
577 Derv(k) = myLScalarConstraints(i).GetPPC()(j).Idv();
581 math_Matrix mat(0, n_dimat-1, 0, n_dimat-1, 0.);
583 fillXYZmatrix(mat,0,0,nCC1,nCC2);
584 fillXYZmatrix(mat,n_dimsousmat,n_dimsousmat,nCC1,nCC2);
585 fillXYZmatrix(mat,2*n_dimsousmat,2*n_dimsousmat,nCC1,nCC2);
588 Standard_Integer kppc = nPPC2;
590 for(i = 1; i<= myLScalarConstraints.Length(); i++) {
591 for( j=0;j<nCC1;j++){
593 math_Vector vmat(1,myLScalarConstraints(i).GetPPC().Length());
595 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++) {
596 Standard_Real signe = 1;
597 if ( ((Deru(j)+Derv(j))%2) == 1) signe = -1;
598 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(j);
599 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(j);
600 vmat(ippc) = signe * SolEm(Points(kppc+ippc-1) - Points(j),iu,iv);
603 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
604 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++){
605 mat(k+irow-1,j) += myLScalarConstraints(i).Coeff()(irow,icol).X()*vmat(icol);
606 mat(k+irow-1,n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Y()*vmat(icol);
607 mat(k+irow-1,2*n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Z()*vmat(icol);
611 Standard_Integer k2 = nCC1;
612 Standard_Integer kppc2 = nCC1;
613 Standard_Integer i2 ;
614 for( i2 = 1; i2<=myLXYZConstraints.Length() ; i2++){
616 math_Matrix tmpmat(1,myLScalarConstraints(i).GetPPC().Length(),1,myLXYZConstraints(i2).GetPPC().Length() );
618 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++)
619 for(Standard_Integer ippc2=1;ippc2 <= myLXYZConstraints(i2).GetPPC().Length() ; ippc2++){
620 Standard_Real signe = 1;
621 if ( ((Deru(kppc2+ippc2-1)+Derv(kppc2+ippc2-1))%2) == 1) signe = -1;
622 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(kppc2+ippc2-1);
623 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(kppc2+ippc2-1);
624 tmpmat(ippc,ippc2) = signe * SolEm(Points(kppc+ippc-1) - Points(kppc2+ippc2-1),iu,iv);
627 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
628 for(Standard_Integer irow2=1;irow2 <= myLXYZConstraints(i2).Coeff().ColLength() ; irow2++)
629 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++)
630 for(Standard_Integer icol2=1;icol2 <= myLXYZConstraints(i2).Coeff().RowLength() ; icol2++){
631 mat(k+irow-1,k2+irow2-1) +=
632 myLScalarConstraints(i).Coeff()(irow,icol).X()*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
633 mat(k+irow-1,n_dimsousmat+k2+irow2-1) +=
634 myLScalarConstraints(i).Coeff()(irow,icol).Y()*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
635 mat(k+irow-1,2*n_dimsousmat+k2+irow2-1) +=
636 myLScalarConstraints(i).Coeff()(irow,icol).Z()*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
639 k2 += myLXYZConstraints(i2).Coeff().ColLength();
640 kppc2 += myLXYZConstraints(i2).Coeff().RowLength();
646 for(Standard_Integer iu = 0; iu< order; iu++)
647 for(Standard_Integer iv =0; iu+iv < order; iv++) {
649 math_Vector vmat(1,myLScalarConstraints(i).GetPPC().Length());
650 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++){
651 Standard_Integer idu = Deru(kppc+ippc-1);
652 Standard_Integer idv = Derv(kppc+ippc-1);
653 vmat(ippc) = Polm (Points(kppc+ippc-1),iu,iv,idu,idv);
656 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
657 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++){
658 mat(k+irow-1,j) += myLScalarConstraints(i).Coeff()(irow,icol).X()*vmat(icol);
659 mat(k+irow-1,n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Y()*vmat(icol);
660 mat(k+irow-1,2*n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Z()*vmat(icol);
669 for(i2 = 1; i2<=i ; i2++){
671 math_Matrix tmpmat(1,myLScalarConstraints(i).GetPPC().Length(),1,myLScalarConstraints(i2).GetPPC().Length() );
673 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++)
674 for(Standard_Integer ippc2=1;ippc2 <= myLScalarConstraints(i2).GetPPC().Length() ; ippc2++){
675 Standard_Real signe = 1;
676 if ( ((Deru(kppc2+ippc2-1)+Derv(kppc2+ippc2-1))%2) == 1) signe = -1;
677 Standard_Integer a_iu = Deru(kppc+ippc-1) + Deru(kppc2+ippc2-1);
678 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(kppc2+ippc2-1);
679 tmpmat(ippc,ippc2) = signe * SolEm(Points(kppc+ippc-1) - Points(kppc2+ippc2-1),a_iu,iv);
682 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
683 for(Standard_Integer irow2=1;irow2 <= myLScalarConstraints(i2).Coeff().ColLength() ; irow2++)
684 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++)
685 for(Standard_Integer icol2=1;icol2 <= myLScalarConstraints(i2).Coeff().RowLength() ; icol2++){
686 mat(k+irow-1,k2+irow2-1) +=
687 myLScalarConstraints(i).Coeff()(irow,icol)*myLScalarConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
690 k2 += myLScalarConstraints(i2).Coeff().ColLength();
691 kppc2 += myLScalarConstraints(i2).Coeff().RowLength();
694 k += myLScalarConstraints(i).Coeff().ColLength();
695 kppc += myLScalarConstraints(i).Coeff().RowLength();
698 for( j=3*n_dimsousmat;j<n_dimat;j++)
704 // initialisation of the Gauss algorithm
705 Standard_Real pivot_max = 1.e-12;
706 OK = Standard_True; // ************ JHH
708 math_Gauss algo_gauss(mat,pivot_max);
709 if(!algo_gauss.IsDone()) {
710 for(i=nCC1+nCC2;i<nCC1+nCC2+nbm;i++) {
712 mat(n_dimsousmat+i,n_dimsousmat+i) = 1.e-8;
713 mat(2*n_dimsousmat+i,2*n_dimsousmat+i) = 1.e-8;
716 math_Gauss thealgo2(mat,pivot_max);
717 algo_gauss = thealgo2;
718 OK = algo_gauss.IsDone();
722 // computation of the linear system solution for the X, Y and Z coordinates
723 math_Vector sec_member( 0, n_dimat-1, 0.);
724 math_Vector sol(0,n_dimat-1);
726 delete [] (gp_XYZ*) solution;
727 n_dim = n_el+order*(order+1)/2;
728 solution = new gp_XYZ[n_dim];
730 Standard_Integer icoor ;
731 for( icoor=1; icoor<=3;icoor++){
733 sec_member((icoor-1)*n_dimsousmat+i) = myConstraints(i+1).Value().Coord(icoor);
737 for(i = 1; i<= myLXYZConstraints.Length(); i++)
738 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++) {
739 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++)
740 sec_member((icoor-1)*n_dimsousmat+k) += myLXYZConstraints(i).Coeff()(irow,icol)
741 * myLXYZConstraints(i).GetPPC()(icol).Value().Coord(icoor);
746 for(i = 1; i<= myLScalarConstraints.Length(); i++)
747 for(Standard_Integer irow =1; irow <= myLScalarConstraints(i).Coeff().ColLength(); irow++) {
748 for(Standard_Integer icol=1; icol<=myLScalarConstraints(i).Coeff().RowLength();icol++)
749 sec_member(k) += myLScalarConstraints(i).Coeff()(irow,icol)
750 * myLScalarConstraints(i).GetPPC()(icol).Value();
754 algo_gauss.Solve(sec_member, sol);
755 //alr iteration pour affiner la solution
757 math_Vector sol1(0,n_dimat-1);
758 math_Vector sec_member1(0,n_dimat-1);
759 for(i=1;i<=IterationNumber;i++)
761 sec_member1 = sec_member - mat*sol;
762 algo_gauss.Solve(sec_member1, sol1);
768 for(icoor=1; icoor<=3;icoor++){
769 for(i=0;i<nCC1;i++) Solution(i).SetCoord (icoor, sol((icoor-1)*n_dimsousmat+i));
771 Standard_Integer kSolution = nCC1;
772 Standard_Integer ksol = nCC1;
774 for(i = 1; i<= myLXYZConstraints.Length(); i++) {
775 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++){
776 Standard_Real vsol = 0;
777 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++)
778 vsol += myLXYZConstraints(i).Coeff()(irow,icol)*sol((icoor-1)*n_dimsousmat+ksol+irow-1);
779 Solution(kSolution).SetCoord (icoor, vsol);
782 ksol += myLXYZConstraints(i).Coeff().ColLength();
786 for(i=0;i<order*(order+1)/2; i++) {
787 Solution(n_el+i).SetCoord (icoor, sol((icoor-1)*n_dimsousmat+ksol+i));
791 Standard_Integer ksol = 3*n_dimsousmat;
792 Standard_Integer kSolution = nPPC2;
793 for(i = 1; i<= myLScalarConstraints.Length(); i++) {
794 for(Standard_Integer icol=1; icol<=myLScalarConstraints(i).Coeff().RowLength();icol++){
795 gp_XYZ Vsol(0.,0.,0.);
796 for(Standard_Integer irow =1; irow <= myLScalarConstraints(i).Coeff().ColLength(); irow++)
797 Vsol += myLScalarConstraints(i).Coeff()(irow,icol)*sol(ksol+irow-1);
798 Solution(kSolution) = Vsol;
801 ksol += myLScalarConstraints(i).Coeff().ColLength();
806 //=======================================================================
807 //function : fillXYZmatrix
809 //=======================================================================
810 void Plate_Plate::fillXYZmatrix(math_Matrix &mat,
811 const Standard_Integer i0,
812 const Standard_Integer j0,
813 const Standard_Integer ncc1,
814 const Standard_Integer ncc2) const
816 Standard_Integer i,j ;
817 for( i=0; i<ncc1;i++) {
819 Standard_Real signe = 1;
820 if ( ((Deru(j)+Derv(j))%2) == 1) signe = -1;
821 Standard_Integer iu = Deru(i) + Deru(j);
822 Standard_Integer iv = Derv(i) + Derv(j);
823 mat(i0+i,j0+j) = signe * SolEm(Points(i) - Points(j),iu,iv);
827 Standard_Integer k = ncc1;
828 Standard_Integer kppc = ncc1;
829 for( i = 1; i<= myLXYZConstraints.Length(); i++){
831 for(Standard_Integer a_j=0; a_j < ncc1; a_j++){
833 math_Vector vmat(1,myLXYZConstraints(i).GetPPC().Length());
835 for(Standard_Integer ippc=1;ippc <= myLXYZConstraints(i).GetPPC().Length() ; ippc++) {
836 Standard_Real signe = 1;
837 if ( ((Deru(a_j)+Derv(a_j))%2) == 1) signe = -1;
838 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(a_j);
839 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(a_j);
840 vmat(ippc) = signe * SolEm(Points(kppc+ippc-1) - Points(a_j),iu,iv);
843 for(Standard_Integer irow=1;irow <= myLXYZConstraints(i).Coeff().ColLength() ; irow++)
844 for(Standard_Integer icol=1;icol <= myLXYZConstraints(i).Coeff().RowLength() ; icol++)
845 mat(i0+k+irow-1,j0+a_j) += myLXYZConstraints(i).Coeff()(irow,icol)*vmat(icol);
848 Standard_Integer k2 = ncc1;
849 Standard_Integer kppc2 = ncc1;
850 for(Standard_Integer i2 = 1; i2<= i; i2++){
852 math_Matrix tmpmat(1,myLXYZConstraints(i).GetPPC().Length(),1,myLXYZConstraints(i2).GetPPC().Length() );
854 for(Standard_Integer ippc=1;ippc <= myLXYZConstraints(i).GetPPC().Length() ; ippc++)
855 for(Standard_Integer ippc2=1;ippc2 <= myLXYZConstraints(i2).GetPPC().Length() ; ippc2++){
856 Standard_Real signe = 1;
857 if ( ((Deru(kppc2+ippc2-1)+Derv(kppc2+ippc2-1))%2) == 1) signe = -1;
858 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(kppc2+ippc2-1);
859 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(kppc2+ippc2-1);
860 tmpmat(ippc,ippc2) = signe * SolEm(Points(kppc+ippc-1) - Points(kppc2+ippc2-1),iu,iv);
863 for(Standard_Integer irow=1;irow <= myLXYZConstraints(i).Coeff().ColLength() ; irow++)
864 for(Standard_Integer irow2=1;irow2 <= myLXYZConstraints(i2).Coeff().ColLength() ; irow2++)
865 for(Standard_Integer icol=1;icol <= myLXYZConstraints(i).Coeff().RowLength() ; icol++)
866 for(Standard_Integer icol2=1;icol2 <= myLXYZConstraints(i2).Coeff().RowLength() ; icol2++)
867 mat(i0+k+irow-1,j0+k2+irow2-1) +=
868 myLXYZConstraints(i).Coeff()(irow,icol)*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
871 k2 += myLXYZConstraints(i2).Coeff().ColLength();
872 kppc2 += myLXYZConstraints(i2).Coeff().RowLength();
875 k += myLXYZConstraints(i).Coeff().ColLength();
876 kppc += myLXYZConstraints(i).Coeff().RowLength();
883 for(Standard_Integer iu = 0; iu< order; iu++)
884 for(Standard_Integer iv =0; iu+iv < order; iv++) {
885 for(Standard_Integer a_j=0; a_j < ncc1; a_j++) {
886 Standard_Integer idu = Deru(a_j);
887 Standard_Integer idv = Derv(a_j);
888 mat(i0+i,j0+a_j) = Polm (Points(a_j), iu, iv, idu, idv);
891 Standard_Integer k2 = ncc1;
892 Standard_Integer kppc2 = ncc1;
893 for(Standard_Integer i2 = 1; i2<= myLXYZConstraints.Length(); i2++){
894 math_Vector vmat(1,myLXYZConstraints(i2).GetPPC().Length());
895 for(Standard_Integer ippc2=1;ippc2 <= myLXYZConstraints(i2).GetPPC().Length() ; ippc2++){
896 Standard_Integer idu = Deru(kppc2+ippc2-1);
897 Standard_Integer idv = Derv(kppc2+ippc2-1);
898 vmat(ippc2) = Polm (Points(kppc2+ippc2-1),iu,iv,idu,idv);
901 for(Standard_Integer irow2=1;irow2 <= myLXYZConstraints(i2).Coeff().ColLength() ; irow2++)
902 for(Standard_Integer icol2=1;icol2 <= myLXYZConstraints(i2).Coeff().RowLength() ; icol2++)
903 mat(i0+i,j0+k2+irow2-1) += myLXYZConstraints(i2).Coeff()(irow2,icol2)*vmat(icol2);
905 k2 += myLXYZConstraints(i2).Coeff().ColLength();
906 kppc2 += myLXYZConstraints(i2).Coeff().RowLength();
912 Standard_Integer n_dimat = ncc1 + ncc2 + order*(order+1)/2;
914 for(i=0;i<n_dimat;i++) {
915 for(Standard_Integer a_j = i+1; a_j < n_dimat; a_j++) {
916 mat(i0+i,j0+a_j) = mat(i0+a_j,j0+i);
922 //=======================================================================
925 //=======================================================================
927 Standard_Boolean Plate_Plate::IsDone() const
933 //=======================================================================
936 //=======================================================================
938 void Plate_Plate::destroy()
943 //=======================================================================
946 //=======================================================================
948 void Plate_Plate::Init()
950 myConstraints.Clear();
951 myLXYZConstraints.Clear();
952 myLScalarConstraints.Clear();
955 delete [] (gp_XYZ*)solution;
958 delete [] (gp_XY*)points;
961 delete [] (Standard_Integer*)deru;
964 delete [] (Standard_Integer*)derv;
971 maxConstraintOrder=0;
974 //=======================================================================
975 //function : Evaluate
977 //=======================================================================
979 gp_XYZ Plate_Plate::Evaluate(const gp_XY& point2d) const
981 if(solution == 0) return gp_XYZ(0,0,0);
982 if(!OK) return gp_XYZ(0,0,0);
984 gp_XYZ valeur(0,0,0);
986 if(!PolynomialPartOnly)
988 for(Standard_Integer i=0; i<n_el;i++)
990 Standard_Real signe = 1;
991 if ( ((Deru(i)+Derv(i))%2) == 1) signe = -1;
992 valeur += Solution(i) * (signe*SolEm(point2d - Points(i), Deru(i), Derv(i))) ;
995 Standard_Integer i = n_el;
996 for(Standard_Integer idu = 0; idu< order; idu++)
997 for(Standard_Integer idv =0; idu+idv < order; idv++)
999 valeur += Solution(i) * Polm( point2d, idu,idv,0,0);
1005 //=======================================================================
1006 //function : EvaluateDerivative
1008 //=======================================================================
1010 gp_XYZ Plate_Plate::EvaluateDerivative(const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv) const
1012 if(solution == 0) return gp_XYZ(0,0,0);
1013 if(!OK) return gp_XYZ(0,0,0);
1015 gp_XYZ valeur(0,0,0);
1016 if(!PolynomialPartOnly)
1018 for(Standard_Integer i=0; i<n_el;i++)
1020 Standard_Real signe = 1;
1021 if ( ((Deru(i)+Derv(i))%2) == 1) signe = -1;
1022 valeur += Solution(i) * (signe*SolEm(point2d - Points(i), Deru(i)+iu, Derv(i)+iv)) ;
1025 Standard_Integer i = n_el;
1026 for(Standard_Integer idu = 0; idu< order; idu++)
1027 for(Standard_Integer idv =0; idu+idv < order; idv++)
1029 valeur += Solution(i) * Polm( point2d, idu,idv, iu,iv);
1034 //=======================================================================
1035 //function : Plate_Plate::CoefPol
1036 //purpose :give back the array of power basis coefficient of
1037 // the polynomial part of the Plate function
1038 //=======================================================================
1040 void Plate_Plate::CoefPol(Handle(TColgp_HArray2OfXYZ)& Coefs) const
1042 Coefs = new TColgp_HArray2OfXYZ(0,order-1,0,order-1,gp_XYZ(0.,0.,0.));
1043 Standard_Integer i = n_el;
1044 for(Standard_Integer iu = 0; iu< order; iu++)
1045 for(Standard_Integer iv =0; iu+iv < order; iv++)
1047 Coefs->ChangeValue(iu,iv) = Solution(i)*ddu[iu]*ddv[iv];
1048 //Coefs->ChangeValue(idu,idv) = Solution(i);
1049 // il faut remettre cette ligne si on enleve ls facteurs dans
1055 //=======================================================================
1056 //function : Plate_Plate::Continuity
1057 //purpose :give back the continuity order of the Plate function
1058 //=======================================================================
1060 Standard_Integer Plate_Plate::Continuity() const
1062 return 2*order - 3 - maxConstraintOrder;
1065 //=======================================================================
1066 //function : Plate_Plate::SolEm
1067 //purpose : compute the (iu,iv)th derivative of the fondamental solution
1068 // of Laplcian at the power order
1069 //=======================================================================
1072 Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv) const
1074 Plate_Plate* aThis = const_cast<Plate_Plate*>(this);
1076 Standard_Integer IU,IV;
1080 // SolEm is symetric in (u<->v) : we swap u and v if iv>iu
1081 // to avoid some code
1084 U = point2d.Y() *ddv[1];
1085 V = point2d.X() *ddu[1];
1091 U = point2d.X() *ddu[1];
1092 V = point2d.Y() *ddv[1];
1095 if((U==Uold)&&(V==Vold) )
1097 if (R<1.e-20) return 0;
1105 if (R<1.e-20) return 0;
1108 Standard_Real DUV = 0;
1110 Standard_Integer m = order;
1111 Standard_Integer mm1 = m-1;
1112 Standard_Real &r = aThis->R;
1115 //Standard_Real pr = pow(R, mm1 - IU - IV);
1116 // cette expression prend beaucoup de temps
1117 //(ne tient pas compte de la petite valeur entiere de l'exposant)
1120 Standard_Integer expo = mm1 - IU - IV;
1125 for(Standard_Integer i=1;i<-expo;i++) pr *= R;
1131 for(Standard_Integer i=1;i<expo;i++) pr *= R;
1157 DUV = 2*pr*U*(1+L*mm1);
1163 Standard_Real m2 = m*m;
1164 //DUV = 4*pr*U*V*(-3+2*L+2*m-3*L*m+L*m2);
1165 DUV = 4*pr*U*V*((2*m-3)+(m2-3*m+2)*L);
1179 Standard_Real m2 = m*m;
1180 DUV = 2*pr*(R-L*R+L*m*R-6*U2+4*L*U2+4*m*U2-6*L*m*U2+2*L*m2*U2);
1186 Standard_Real m2 = m*m;
1187 Standard_Real m3 = m2*m;
1188 DUV = -3*R+2*L*R+2*m*R-3*L*m*R+L*m2*R+22*U2-12*L*U2-24*m*U2+22*L*m*U2+6*m2*U2-12*L*m2*U2+2*L*m3*U2;
1189 DUV = DUV * 4* pr*V;
1195 Standard_Real m2 = m*m;
1196 Standard_Real m3 = m2*m;
1197 Standard_Real m4 = m2*m2;
1198 Standard_Real V2 = V*V;
1199 Standard_Real R2 = R*R;
1200 DUV = -3*R2+2*L*R2+2*m*R2-3*L*m*R2+L*m2*R2+22*R*U2-12*L*R*U2-24*m*R*U2+22*L*m*R*U2+6*m2*R*U2-12*L*m2*R*U2;
1201 DUV += 2*L*m3*R*U2+22*R*V2-12*L*R*V2-24*m*R*V2+22*L*m*R*V2+6*m2*R*V2-12*L*m2*R*V2+2*L*m3*R*V2-200*U2*V2+96*L*U2*V2;
1202 DUV += 280*m*U2*V2-200*L*m*U2*V2-120*m2*U2*V2+140*L*m2*U2*V2+16*m3*U2*V2-40*L*m3*U2*V2+4*L*m4*U2*V2;
1217 Standard_Real m2 = m*m;
1218 Standard_Real m3 = m2*m;
1219 DUV = -9*R+6*L*R+6*m*R-9*L*m*R+3*L*m2*R+22*U2-12*L*U2-24*m*U2+22*L*m*U2+6*m2*U2-12*L*m2*U2+2*L*m3*U2;
1220 DUV = DUV * 4* pr*U;
1226 Standard_Real m2 = m*m;
1227 Standard_Real m3 = m2*m;
1228 Standard_Real m4 = m2*m2;
1229 DUV = 33*R-18*L*R-36*m*R+33*L*m*R+9*m2*R-18*L*m2*R+3*L*m3*R-100*U2+48*L*U2+140*m*U2-100*L*m*U2-60*m2*U2+70*L*m2*U2;
1230 DUV += 8*m3*U2-20*L*m3*U2+2*L*m4*U2;
1237 Standard_Real m2 = m*m;
1238 Standard_Real m3 = m2*m;
1239 Standard_Real m4 = m2*m2;
1240 Standard_Real m5 = m4*m;
1241 Standard_Real ru2 = R*U2;
1242 Standard_Real v2 = V*V;
1243 Standard_Real rv2 = R*v2;
1244 Standard_Real u2v2 = v2*U2;
1245 Standard_Real r2 = r*r;
1247 // copier-coller de mathematica
1249 -100*ru2 + 48*L*ru2 + 140*m*ru2 - 100*L*m*ru2 - 60*m2*ru2 + 70*L*m2*ru2 + 8*m3*ru2 -
1250 20*L*m3*ru2 + 2*L*m4*ru2 - 300*rv2 + 144*L*rv2 + 420*m*rv2 - 300*L*m*rv2 - 180*m2*rv2 + 210*L*m2*rv2 +
1251 24*m3*rv2 - 60*L*m3*rv2 + 6*L*m4*rv2 + 33*r2 - 18*L*r2 - 36*m*r2 + 33*L*m*r2 + 9*m2*r2 - 18*L*m2*r2 +
1252 3*L*m3*r2 + 1096*u2v2 - 480*L*u2v2 - 1800*m*u2v2 + 1096*L*m*u2v2 + 1020*m2*u2v2 - 900*L*m2*u2v2 -
1253 240*m3*u2v2 + 340*L*m3*u2v2 + 20*m4*u2v2 - 60*L*m4*u2v2 + 4*L*m5*u2v2;
1261 Standard_Real m2 = m*m;
1262 Standard_Real m3 = m2*m;
1263 Standard_Real m4 = m2*m2;
1264 Standard_Real m5 = m3*m2;
1265 Standard_Real m6 = m3*m3;
1266 Standard_Real ru2 = r*U2;
1267 Standard_Real v2 = V*V;
1268 Standard_Real rv2 = R*v2;
1269 Standard_Real u2v2 = v2*U2;
1270 Standard_Real r2 = r*r;
1272 // copier-coller de mathematica
1274 1644*ru2 - 720*L*ru2 - 2700*m*ru2 + 1644*L*m*ru2 + 1530*m2*ru2 - 1350*L*m2*ru2 -
1275 360*m3*ru2 + 510*L*m3*ru2 + 30*m4*ru2 - 90*L*m4*ru2 + 6*L*m5*ru2 + 1644*rv2 - 720*L*rv2 - 2700*m*rv2 +
1276 1644*L*m*rv2 + 1530*m2*rv2 - 1350*L*m2*rv2 - 360*m3*rv2 + 510*L*m3*rv2 + 30*m4*rv2 - 90*L*m4*rv2 +
1277 6*L*m5*rv2 - 450*r2 + 216*L*r2 + 630*m*r2 - 450*L*m*r2 - 270*m2*r2 + 315*L*m2*r2 + 36*m3*r2 - 90*L*m3*r2 +
1278 9*L*m4*r2 - 7056*u2v2 + 2880*L*u2v2 + 12992*m*u2v2 - 7056*L*m*u2v2 - 8820*m2*u2v2 + 6496*L*m2*u2v2 +
1279 2800*m3*u2v2 - 2940*L*m3*u2v2 - 420*m4*u2v2 + 700*L*m4*u2v2 + 24*m5*u2v2 - 84*L*m5*u2v2 + 4*L*m6*u2v2;
1281 DUV = 16*pr*U*V*DUV;
1295 Standard_Real m2 = m*m;
1296 Standard_Real m3 = m2*m;
1297 Standard_Real m4 = m2*m2;
1298 Standard_Real U4 = U2*U2;
1299 Standard_Real R2 = R*R;
1300 DUV = -9*R2+6*L*R2+6*m*R2-9*L*m*R2+3*L*m2*R2+132*R*U2-72*L*R*U2-144*m*R*U2+132*L*m*R*U2+36*m2*R*U2-72*L*m2*R*U2;
1301 DUV += 12*L*m3*R*U2-200*U4+96*L*U4+280*m*U4-200*L*m*U4-120*m2*U4+140*L*m2*U4+16*m3*U4-40*L*m3*U4+4*L*m4*U4;
1308 Standard_Real m2 = m*m;
1309 Standard_Real m3 = m2*m;
1310 Standard_Real m4 = m2*m2;
1311 Standard_Real m5 = m2*m3;
1312 Standard_Real u4 = U2*U2;
1313 Standard_Real ru2 = R*U2;
1314 Standard_Real r2 = R*R;
1316 // copier-coller de mathematica
1318 -600*ru2 + 288*L*ru2 + 840*m*ru2 - 600*L*m*ru2 - 360*m2*ru2 + 420*L*m2*ru2 + 48*m3*ru2 -
1319 120*L*m3*ru2 + 12*L*m4*ru2 + 33*r2 - 18*L*r2 - 36*m*r2 + 33*L*m*r2 + 9*m2*r2 - 18*L*m2*r2 + 3*L*m3*r2 +
1320 1096*u4 - 480*L*u4 - 1800*m*u4 + 1096*L*m*u4 + 1020*m2*u4 - 900*L*m2*u4 - 240*m3*u4 + 340*L*m3*u4 + 20*m4*u4 -
1321 60*L*m4*u4 + 4*L*m5*u4;
1329 Standard_Real m2 = m*m;
1330 Standard_Real m3 = m2*m;
1331 Standard_Real m4 = m2*m2;
1332 Standard_Real m5 = m2*m3;
1333 Standard_Real m6 = m3*m3;
1334 Standard_Real u4 = U2*U2;
1335 Standard_Real r2 = r*r;
1336 Standard_Real r3 = r2*r;
1337 Standard_Real v2 = V*V;
1338 Standard_Real u2v2 = v2*U2;
1339 Standard_Real ru2v2 = R*u2v2;
1340 Standard_Real u4v2 = u4*v2;
1341 Standard_Real r2u2 = r2*U2;
1342 Standard_Real ru4 = r*u4;
1343 Standard_Real r2v2 = r2*v2;
1345 // copier-coller de mathematica
1347 6576*ru2v2 - 2880*L*ru2v2 - 10800*m*ru2v2 + 6576*L*m*ru2v2 + 6120*m2*ru2v2 - 5400*L*m2*ru2v2 -
1348 1440*m3*ru2v2 + 2040*L*m3*ru2v2 + 120*m4*ru2v2 - 360*L*m4*ru2v2 + 24*L*m5*ru2v2 + 1096*ru4 - 480*L*ru4 -
1349 1800*m*ru4 + 1096*L*m*ru4 + 1020*m2*ru4 - 900*L*m2*ru4 - 240*m3*ru4 + 340*L*m3*ru4 + 20*m4*ru4 - 60*L*m4*ru4 +
1350 4*L*m5*ru4 - 600*r2u2 + 288*L*r2u2 + 840*m*r2u2 - 600*L*m*r2u2 - 360*m2*r2u2 + 420*L*m2*r2u2 + 48*m3*r2u2 -
1351 120*L*m3*r2u2 + 12*L*m4*r2u2 - 300*r2v2 + 144*L*r2v2 + 420*m*r2v2 - 300*L*m*r2v2 - 180*m2*r2v2 + 210*L*m2*r2v2 +
1352 24*m3*r2v2 - 60*L*m3*r2v2 + 6*L*m4*r2v2 + 33*r3 - 18*L*r3 - 36*m*r3 + 33*L*m*r3 + 9*m2*r3 - 18*L*m2*r3 +
1353 3*L*m3*r3 - 14112*u4v2 + 5760*L*u4v2 + 25984*m*u4v2 - 14112*L*m*u4v2 - 17640*m2*u4v2 + 12992*L*m2*u4v2 +
1354 5600*m3*u4v2 - 5880*L*m3*u4v2 - 840*m4*u4v2 + 1400*L*m4*u4v2 + 48*m5*u4v2 - 168*L*m5*u4v2 + 8*L*m6*u4v2;
1362 Standard_Real m2 = m*m;
1363 Standard_Real m3 = m2*m;
1364 Standard_Real m4 = m2*m2;
1365 Standard_Real m5 = m2*m3;
1366 Standard_Real m6 = m3*m3;
1367 Standard_Real m7 = m3*m4;
1368 Standard_Real u4 = U2*U2;
1369 Standard_Real r2 = r*r;
1370 Standard_Real r3 = r2*r;
1371 Standard_Real v2 = V*V;
1372 Standard_Real u2v2 = v2*U2;
1373 Standard_Real ru2v2 = R*u2v2;
1374 Standard_Real u4v2 = u4*v2;
1375 Standard_Real r2u2 = r2*U2;
1376 Standard_Real r2v2 = r2*v2;
1377 Standard_Real ru4 = r*u4;
1379 // copier-coller de mathematica
1381 -42336*ru2v2 + 17280*L*ru2v2 + 77952*m*ru2v2 - 42336*L*m*ru2v2 - 52920*m2*ru2v2 +
1382 38976*L*m2*ru2v2 + 16800*m3*ru2v2 - 17640*L*m3*ru2v2 - 2520*m4*ru2v2 + 4200*L*m4*ru2v2 + 144*m5*ru2v2 -
1383 504*L*m5*ru2v2 + 24*L*m6*ru2v2 - 21168*ru4 + 8640*L*ru4 + 38976*m*ru4 - 21168*L*m*ru4 - 26460*m2*ru4 +
1384 19488*L*m2*ru4 + 8400*m3*ru4 - 8820*L*m3*ru4 - 1260*m4*ru4 + 2100*L*m4*ru4 + 72*m5*ru4 - 252*L*m5*ru4 +
1385 12*L*m6*ru4 + 9864*r2u2 - 4320*L*r2u2 - 16200*m*r2u2 + 9864*L*m*r2u2 + 9180*m2*r2u2 - 8100*L*m2*r2u2 -
1386 2160*m3*r2u2 + 3060*L*m3*r2u2 + 180*m4*r2u2 - 540*L*m4*r2u2 + 36*L*m5*r2u2 + 1644*r2v2 - 720*L*r2v2 -
1387 2700*m*r2v2 + 1644*L*m*r2v2 + 1530*m2*r2v2 - 1350*L*m2*r2v2 - 360*m3*r2v2 + 510*L*m3*r2v2 + 30*m4*r2v2 -
1388 90*L*m4*r2v2 + 6*L*m5*r2v2 - 450*r3 + 216*L*r3 + 630*m*r3 - 450*L*m*r3 - 270*m2*r3 + 315*L*m2*r3 + 36*m3*r3 -
1389 90*L*m3*r3 + 9*L*m4*r3 + 104544*u4v2 - 40320*L*u4v2 - 210112*m*u4v2 + 104544*L*m*u4v2 + 162456*m2*u4v2 -
1390 105056*L*m2*u4v2 - 62720*m3*u4v2 + 54152*L*m3*u4v2 + 12880*m4*u4v2 - 15680*L*m4*u4v2 - 1344*m5*u4v2 +
1391 2576*L*m5*u4v2 + 56*m6*u4v2 - 224*L*m6*u4v2 + 8*L*m7*u4v2;
1407 Standard_Real m2 = m*m;
1408 Standard_Real m3 = m2*m;
1409 Standard_Real m4 = m2*m2;
1410 Standard_Real m5 = m2*m3;
1411 Standard_Real u4 = U2*U2;
1412 Standard_Real r2 = R*R;
1413 Standard_Real ru2 = R*U2;
1415 // copier-coller de mathematica
1417 -1000*ru2 + 480*L*ru2 + 1400*m*ru2 - 1000*L*m*ru2 - 600*m2*ru2 + 700*L*m2*ru2 + 80*m3*ru2 -
1418 200*L*m3*ru2 + 20*L*m4*ru2 + 165*r2 - 90*L*r2 - 180*m*r2 + 165*L*m*r2 + 45*m2*r2 - 90*L*m2*r2 + 15*L*m3*r2 +
1419 1096*u4 - 480*L*u4 - 1800*m*u4 + 1096*L*m*u4 + 1020*m2*u4 - 900*L*m2*u4 - 240*m3*u4 + 340*L*m3*u4 + 20*m4*u4 -
1420 60*L*m4*u4 + 4*L*m5*u4;
1428 Standard_Real m2 = m*m;
1429 Standard_Real m3 = m2*m;
1430 Standard_Real m4 = m2*m2;
1431 Standard_Real m5 = m2*m3;
1432 Standard_Real m6 = m3*m3;
1433 Standard_Real u4 = U2*U2;
1434 Standard_Real ru2 = r*U2;
1435 Standard_Real r2 = r*r;
1438 // copier-coller de mathematica
1440 5480*ru2 - 2400*L*ru2 - 9000*m*ru2 + 5480*L*m*ru2 + 5100*m2*ru2 - 4500*L*m2*ru2 - 1200*m3*ru2 +
1441 1700*L*m3*ru2 + 100*m4*ru2 - 300*L*m4*ru2 + 20*L*m5*ru2 - 750*r2 + 360*L*r2 + 1050*m*r2 - 750*L*m*r2 -
1442 450*m2*r2 + 525*L*m2*r2 + 60*m3*r2 - 150*L*m3*r2 + 15*L*m4*r2 - 7056*u4 + 2880*L*u4 + 12992*m*u4 - 7056*L*m*u4 -
1443 8820*m2*u4 + 6496*L*m2*u4 + 2800*m3*u4 - 2940*L*m3*u4 - 420*m4*u4 + 700*L*m4*u4 + 24*m5*u4 - 84*L*m5*u4 +
1446 DUV = 16*pr*U*V*DUV;
1452 Standard_Real m2 = m*m;
1453 Standard_Real m3 = m2*m;
1454 Standard_Real m4 = m2*m2;
1455 Standard_Real m5 = m2*m3;
1456 Standard_Real m6 = m3*m3;
1457 Standard_Real m7 = m3*m4;
1458 Standard_Real u4 = U2*U2;
1459 Standard_Real r2 = r*r;
1460 Standard_Real r3 = r2*r;
1461 Standard_Real v2 = V*V;
1462 Standard_Real u2v2 = v2*U2;
1463 Standard_Real ru2v2 = R*u2v2;
1464 Standard_Real u4v2 = u4*v2;
1465 Standard_Real r2u2 = r2*U2;
1466 Standard_Real r2v2 = r2*v2;
1467 Standard_Real ru4 = r*u4;
1469 // copier-coller de mathematica
1472 -70560*ru2v2 + 28800*L*ru2v2 + 129920*m*ru2v2 - 70560*L*m*ru2v2 - 88200*m2*ru2v2 +
1473 64960*L*m2*ru2v2 + 28000*m3*ru2v2 - 29400*L*m3*ru2v2 - 4200*m4*ru2v2 + 7000*L*m4*ru2v2 + 240*m5*ru2v2 -
1474 840*L*m5*ru2v2 + 40*L*m6*ru2v2 - 7056*ru4 + 2880*L*ru4 + 12992*m*ru4 - 7056*L*m*ru4 - 8820*m2*ru4 +
1475 6496*L*m2*ru4 + 2800*m3*ru4 - 2940*L*m3*ru4 - 420*m4*ru4 + 700*L*m4*ru4 + 24*m5*ru4 - 84*L*m5*ru4 + 4*L*m6*ru4 +
1476 5480*r2u2 - 2400*L*r2u2 - 9000*m*r2u2 + 5480*L*m*r2u2 + 5100*m2*r2u2 - 4500*L*m2*r2u2 - 1200*m3*r2u2 +
1477 1700*L*m3*r2u2 + 100*m4*r2u2 - 300*L*m4*r2u2 + 20*L*m5*r2u2 + 8220*r2v2 - 3600*L*r2v2 - 13500*m*r2v2 +
1478 8220*L*m*r2v2 + 7650*m2*r2v2 - 6750*L*m2*r2v2 - 1800*m3*r2v2 + 2550*L*m3*r2v2 + 150*m4*r2v2 - 450*L*m4*r2v2 +
1479 30*L*m5*r2v2 - 750*r3 + 360*L*r3 + 1050*m*r3 - 750*L*m*r3 - 450*m2*r3 + 525*L*m2*r3 + 60*m3*r3 - 150*L*m3*r3 +
1480 15*L*m4*r3 + 104544*u4v2 - 40320*L*u4v2 - 210112*m*u4v2 + 104544*L*m*u4v2 + 162456*m2*u4v2 - 105056*L*m2*u4v2 -
1481 62720*m3*u4v2 + 54152*L*m3*u4v2 + 12880*m4*u4v2 - 15680*L*m4*u4v2 - 1344*m5*u4v2 + 2576*L*m5*u4v2 + 56*m6*u4v2 -
1482 224*L*m6*u4v2 + 8*L*m7*u4v2;
1498 Standard_Real m2 = m*m;
1499 Standard_Real m3 = m2*m;
1500 Standard_Real m4 = m2*m2;
1501 Standard_Real m5 = m2*m3;
1502 Standard_Real m6 = m3*m3;
1503 Standard_Real u4 = U2*U2;
1504 Standard_Real u6 = U2*u4;
1505 Standard_Real r2 = r*r;
1506 Standard_Real r3 = r2*r;
1507 Standard_Real r2u2 = r2*U2;
1508 Standard_Real ru4 = r*u4;
1510 // copier-coller de mathematica
1512 16440*ru4 - 7200*L*ru4 - 27000*m*ru4 + 16440*L*m*ru4 + 15300*m2*ru4 - 13500*L*m2*ru4 -
1513 3600*m3*ru4 + 5100*L*m3*ru4 + 300*m4*ru4 - 900*L*m4*ru4 + 60*L*m5*ru4 - 4500*r2u2 + 2160*L*r2u2 + 6300*m*r2u2 -
1514 4500*L*m*r2u2 - 2700*m2*r2u2 + 3150*L*m2*r2u2 + 360*m3*r2u2 - 900*L*m3*r2u2 + 90*L*m4*r2u2 + 165*r3 - 90*L*r3 -
1515 180*m*r3 + 165*L*m*r3 + 45*m2*r3 - 90*L*m2*r3 + 15*L*m3*r3 - 14112*u6 + 5760*L*u6 + 25984*m*u6 - 14112*L*m*u6 -
1516 17640*m2*u6 + 12992*L*m2*u6 + 5600*m3*u6 - 5880*L*m3*u6 - 840*m4*u6 + 1400*L*m4*u6 + 48*m5*u6 - 168*L*m5*u6 +
1532 return DUV * ddu[iu]*ddv[iv];
1537 //=======================================================================
1540 //=======================================================================
1542 void Plate_Plate::UVBox(Standard_Real& UMin, Standard_Real& UMax,
1543 Standard_Real& VMin, Standard_Real& VMax) const
1545 Standard_Integer i ;
1546 const Standard_Real Bmin = 1.e-3;
1547 UMin = myConstraints(1).Pnt2d().X();
1549 VMin = myConstraints(1).Pnt2d().Y();
1552 for( i=2; i<=myConstraints.Length();i++)
1554 Standard_Real x = myConstraints(i).Pnt2d().X();
1555 if(x<UMin) UMin = x;
1556 if(x>UMax) UMax = x;
1557 Standard_Real y = myConstraints(i).Pnt2d().Y();
1558 if(y<VMin) VMin = y;
1559 if(y>VMax) VMax = y;
1562 for(i=1; i<=myLXYZConstraints.Length();i++)
1563 for(Standard_Integer j=1;j<= myLXYZConstraints(i).GetPPC().Length(); j++)
1565 Standard_Real x = myLXYZConstraints(i).GetPPC()(j).Pnt2d().X();
1566 if(x<UMin) UMin = x;
1567 if(x>UMax) UMax = x;
1568 Standard_Real y = myLXYZConstraints(i).GetPPC()(j).Pnt2d().Y();
1569 if(y<VMin) VMin = y;
1570 if(y>VMax) VMax = y;
1573 for(i=1; i<=myLScalarConstraints.Length();i++)
1574 for(Standard_Integer j=1;j<= myLScalarConstraints(i).GetPPC().Length(); j++)
1576 Standard_Real x = myLScalarConstraints(i).GetPPC()(j).Pnt2d().X();
1577 if(x<UMin) UMin = x;
1578 if(x>UMax) UMax = x;
1579 Standard_Real y = myLScalarConstraints(i).GetPPC()(j).Pnt2d().Y();
1580 if(y<VMin) VMin = y;
1581 if(y>VMax) VMax = y;
1585 if(UMax-UMin < Bmin)
1587 Standard_Real UM = 0.5*(UMin+UMax);
1588 UMin = UM - 0.5*Bmin;
1589 UMax = UM + 0.5*Bmin;
1591 if(VMax-VMin < Bmin)
1593 Standard_Real VM = 0.5*(VMin+VMax);
1594 VMin = VM - 0.5*Bmin;
1595 VMax = VM + 0.5*Bmin;
1599 //=======================================================================
1600 //function : UVConstraints
1602 //=======================================================================
1604 void Plate_Plate::UVConstraints(TColgp_SequenceOfXY& Seq) const
1606 for (Standard_Integer i=1;i<=myConstraints.Length();i++) {
1607 if ((myConstraints.Value(i).Idu()==0) && (myConstraints.Value(i).Idv()==0))
1608 Seq.Append((myConstraints.Value(i)).Pnt2d());
1611 //=======================================================================
1613 void Plate_Plate::SetPolynomialPartOnly(const Standard_Boolean PPOnly)
1615 PolynomialPartOnly = PPOnly;