ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/vct_face.cpp
Revision: 67
Committed: Tue Mar 25 15:59:01 2008 UTC (17 years, 1 month ago) by souaissa
Original Path: magic/lib/geometrie/geometrie/src/vct_face.cpp
File size: 21957 byte(s)
Log Message:
mise en conformité des noms de topologies dans la vectorisation

File Contents

# User Rev Content
1 souaissa 66 #include "gestionversion.h"
2     //---------------------------------------------------------------------------
3    
4    
5     #pragma hdrstop
6    
7     #include "vct_face.h"
8     #include "mg_face.h"
9     #include "mg_surface.h"
10    
11     #include "mg_arete.h"
12     #include "ot_mathematique.h"
13     #include <math>
14     #include <iomanip>
15     #include "sld_fonction.h"
16    
17     //---------------------------------------------------------------------------
18    
19     #pragma package(smart_init)
20    
21    
22    
23     VCT_FACE::VCT_FACE(MG_FACE* face):VCT_ELEMENT_TOPOLOGIQUE(face)
24     {
25    
26     MG_SURFACE* surf=((MG_FACE*)elem_topo)->get_surface();
27     //VCT_SURFACE vct_surf(surf);
28     vct_surf=new VCT_SURFACE(surf);
29 souaissa 67 //nb_pts_surf=vct_surf->get_nb_points();
30     //vector<double2> LISTE_GEO_VECTEUR_FACE;
31     //vct_surf->get_vectorisation(LISTE_GEO_VECTEUR_FACE);
32 souaissa 66 int indx1_premier,indx2_premier;
33 souaissa 67 //nb_geo_points=0;
34     int nb_geo_points=0;
35 souaissa 66 nb_topo_points=0;
36    
37     int nb_boucle=((MG_FACE*)elem_topo)->get_nb_mg_boucle();
38     for(int j=0;j<nb_boucle;j++)
39     {
40     MG_BOUCLE* Boucle = ((MG_FACE*)elem_topo)->get_mg_boucle(j);
41     int nbarete = Boucle->get_nb_mg_coarete();
42     for (int w =0; w<nbarete;w++)
43     {
44     TPL_LISTE_ENTITE<double> contr_param;
45     vector<double2> list_geo_temp;
46     vector<double2> liste_topo_temp;
47    
48     MG_COARETE* coArete = Boucle->get_mg_coarete(w);
49     MG_ARETE* Arete = coArete->get_arete();
50     Arete->get_param_NURBS(indx2_premier,contr_param);
51 souaissa 67 VCT_ARETE vct_aret(Arete);
52    
53 souaissa 66 for(int i=indx2_premier;i<contr_param.get_nb();i++)// -4
54     LISTE_POINTS_CTRS.insert(LISTE_POINTS_CTRS.end(),contr_param.get(i));
55    
56 souaissa 67 //int nb_pts_crb=vct_aret.get_nb_geo_points();
57     //nb_geo_points+=nb_pts_crb;
58     //vct_aret.get_geo_vectorisation(list_geo_temp);
59 souaissa 66 vct_aret.get_topo_vectorisation(liste_topo_temp) ;
60     int nb_pts_art=vct_aret.get_nb_topo_points();
61     nb_topo_points+=nb_pts_art;//-1
62     //nt nb_lst=liste_topo_temp.size();
63     //insertion de la vectorisation des aretes
64     //la vectorisation de la topologie d<une face
65     //revient a la vectorisation topologique de ces aretes
66     for(unsigned int i=0;i<liste_topo_temp.size();i++)
67     {
68     LISTE_TOPO_VECTEURS_CONTOURS.insert(LISTE_TOPO_VECTEURS_CONTOURS.end(),liste_topo_temp[i]);
69     LISTE_TOPO_VECTEUR_FACE.insert(LISTE_TOPO_VECTEUR_FACE.end(),liste_topo_temp[i]);
70     }
71    
72     }
73    
74     }
75 souaissa 67 // nb_geo_points+=nb_pts_surf;
76    
77 souaissa 66 }
78    
79    
80    
81     VCT_FACE::VCT_FACE(VCT_FACE& mdd):VCT_ELEMENT_TOPOLOGIQUE(mdd.elem_topo)
82     {
83 souaissa 67 //LISTE_GEO_VECTEUR_FACE=mdd.LISTE_GEO_VECTEUR_FACE;
84 souaissa 66 LISTE_TOPO_VECTEUR_FACE=mdd.LISTE_TOPO_VECTEUR_FACE;
85 souaissa 67 //LISTE_GEO_VECTEURS_CONTOURS=mdd.LISTE_GEO_VECTEURS_CONTOURS;
86 souaissa 66 LISTE_TOPO_VECTEURS_CONTOURS=mdd.LISTE_TOPO_VECTEURS_CONTOURS;
87 souaissa 67 //nb_geo_points=mdd.nb_geo_points;
88     nb_topo_points=mdd.nb_topo_points;
89    
90 souaissa 66 }
91    
92    
93     VCT_FACE::~ VCT_FACE()
94     {
95 souaissa 67 //delete vct_surf;
96 souaissa 66 }
97    
98 souaissa 67 /*
99 souaissa 66 VCT_SURFACE* VCT_FACE::get_vct_surface()
100     {
101     return vct_surf;
102 souaissa 67 }*/
103 souaissa 66
104     void VCT_FACE::get_topo_vectorisation(vector<double2>& lst)
105     {
106     lst= LISTE_TOPO_VECTEUR_FACE;
107     }
108 souaissa 67 /*
109 souaissa 66 void VCT_FACE::get_geo_vectorisation(vector<double2>& lst)
110     {
111     lst=LISTE_GEO_VECTEUR_FACE;
112 souaissa 67 } */
113 souaissa 66
114     void VCT_FACE::get_vectorisation_topo_contr(vector<double2>& lst)
115     {
116     lst= LISTE_TOPO_VECTEURS_CONTOURS ;
117     }
118 souaissa 67 /*
119 souaissa 66 void VCT_FACE::get_vectorisation_geo_contr(vector<double2>& lst)
120     {
121     lst= LISTE_GEO_VECTEURS_CONTOURS;
122 souaissa 67 } */
123     /*
124 souaissa 66 OT_TNS<double2,4> VCT_FACE:: get_tenseur_metrique_surface()
125     {
126     OT_TNS<double2,4> tns_met(LISTE_GEO_VECTEUR_FACE);
127     double2 eps=1e-2;
128     for(int i=0;i<tns_met.nb_lgns();i++)
129     for(int j=0;j<tns_met.nb_cols();j++)
130     if (fabs(tns_met(i,j))<eps)tns_met(i,j)=0;
131     return tns_met;
132 souaissa 67 } */
133 souaissa 66
134     OT_TNS<double2,4> VCT_FACE:: get_tenseur_metrique_aretes()
135     {
136     OT_TNS<double2,4> tns_met(LISTE_TOPO_VECTEUR_FACE);
137     double2 eps=1e-2;
138     for(int i=0;i<tns_met.nb_lgns();i++)
139     for(int j=0;j<tns_met.nb_cols();j++)
140     if (fabs(tns_met(i,j))<eps)tns_met(i,j)=0;
141     return tns_met;
142     }
143    
144    
145    
146    
147    
148    
149    
150    
151 souaissa 67 /*
152 souaissa 66 void VCT_FACE::get_geo_barycentre(double2* xyz)
153     {
154    
155     // MG_SURFACE* surf=((MG_FACE*)elem_topo)->get_surface();
156     // VCT_SURFACE vct_surf(surf);
157     vct_surf->get_geo_barycentre(xyz);
158 souaissa 67 } */
159 souaissa 66
160     void VCT_FACE::get_topo_barycentre(double2* xyz)
161     {
162    
163     for(int i=0;i<4;i++)xyz[i]=0.;
164    
165     for(int i=0;i<nb_topo_points;i++)
166     {
167     xyz[0]= xyz[0]+LISTE_POINTS_CTRS[4*i];
168     xyz[1]= xyz[1]+LISTE_POINTS_CTRS[4*i+1];
169     xyz[2]= xyz[2]+LISTE_POINTS_CTRS[4*i+2];
170     xyz[3]= xyz[3]+LISTE_POINTS_CTRS[4*i+3];
171     }
172    
173    
174     xyz[0]=(1./nb_topo_points)*xyz[0];
175     xyz[1]=(1./nb_topo_points)*xyz[1];
176     xyz[2]=(1./nb_topo_points)*xyz[2];
177     xyz[3]=(1./nb_topo_points)*xyz[3];
178     }
179    
180    
181     double2 VCT_FACE::get_inertie_au_centre_de_masse()
182     {
183    
184     double2 inirtia_face=0. ;
185     double2 centre_masse_face[4];
186     get_topo_barycentre(centre_masse_face);
187    
188     for(int i=0;i<nb_topo_points;i++)
189     {
190     for(int j=0;j<4;j++){
191     double2 xji= LISTE_POINTS_CTRS[4*i+j];
192     xji=xji- centre_masse_face[j];
193     inirtia_face=inirtia_face+xji*xji;
194     }
195    
196     }
197    
198     return inirtia_face;
199    
200     }
201    
202    
203    
204     double2 VCT_FACE:: get_inertie_au_point(double2* xyz)
205     {
206    
207     double2 centre_de_masse[4];
208     double2 inertie_au_point_xyz;
209    
210     double2 inertie_au_centre_de_masse=get_inertie_au_centre_de_masse();
211    
212     this->get_topo_barycentre(centre_de_masse);
213    
214    
215     double2 d_x=xyz[0]-centre_de_masse[0] ;
216     double2 d_y=xyz[1]-centre_de_masse[1] ;
217     double2 d_z=xyz[2]-centre_de_masse[2] ;
218     double2 d_w=xyz[3]-centre_de_masse[3] ;
219    
220     double2 dis_GXYZ=d_x*d_x+d_y*d_y+d_z*d_z+d_w*d_w;
221    
222     inertie_au_point_xyz=inertie_au_centre_de_masse+nb_topo_points*dis_GXYZ; //nb_topo_points : ici elle represente la masse totale
223    
224     return inertie_au_point_xyz;
225     }
226    
227    
228 souaissa 67 /*
229 souaissa 66 int VCT_FACE::get_nb_geo_points()
230     {
231     return nb_geo_points ;
232 souaissa 67 } */
233 souaissa 66
234     int VCT_FACE::get_nb_topo_points()
235     {
236     return nb_topo_points ;
237     }
238    
239    
240     void VCT_FACE::get_covariance(double2* cov)
241     {
242     // la covariance tient en compte des points de ctrs de la surface et des aretes.
243     double2 bary[4];
244    
245     get_topo_barycentre(bary);
246    
247     double2 *pt_au_centre_masse=new double2[nb_topo_points*3] ;
248    
249     for(int k=0;k<nb_topo_points;k++)
250     {
251     for(int j=0;j<3;j++){
252     double2 xjk= LISTE_POINTS_CTRS[4*k+j];
253     pt_au_centre_masse[k*3+j]=xjk- bary[j];
254     }
255     }
256    
257    
258    
259     for(int i=0;i<9;i++)cov[i]=0.;
260    
261     for(int k=0;k<nb_topo_points;k++)
262     {
263     cov[0*3+0]= cov[0*3+0]+pt_au_centre_masse[k*3+0]*pt_au_centre_masse[k*3+0];
264     cov[0*3+1]= cov[0*3+1]+pt_au_centre_masse[k*3+0]*pt_au_centre_masse[k*3+1];
265     cov[0*3+2]= cov[0*3+2]+pt_au_centre_masse[k*3+0]*pt_au_centre_masse[k*3+2];
266     cov[1*3+1]= cov[1*3+1]+pt_au_centre_masse[k*3+1]*pt_au_centre_masse[k*3+1];
267     cov[1*3+2]= cov[1*3+2]+pt_au_centre_masse[k*3+1]*pt_au_centre_masse[k*3+2];
268     cov[2*3+2]= cov[2*3+2]+pt_au_centre_masse[k*3+2]*pt_au_centre_masse[k*3+2];
269     }
270    
271     cov[1*3+0]=cov[0*3+1] ;
272     cov[2*3+0]=cov[0*3+2] ;
273     cov[2*3+1]=cov[1*3+2] ;
274    
275     for(int i=0;i<9;i++) cov[i]=1./(nb_topo_points)*cov[i];
276     delete [] pt_au_centre_masse;
277    
278     }
279    
280    
281     void VCT_FACE::get_axes_dinertie(OT_VECTEUR_3D& vp1,OT_VECTEUR_3D& vp2,OT_VECTEUR_3D& vp3)
282     {
283     int n=3, nrot;
284     OT_MATRICE_3D m_cov;
285     int fait=-1;
286     double *ccov;
287     double2 cov[9];
288     get_covariance(cov);
289     for(int i=0;i<9;i++)
290     {
291     double x =cov[i].get_x() ;
292     if (fabs(x)<1e-14)
293     cov[i]=0.;
294    
295     }
296    
297    
298     #define cov(i,j)(*(cov+i*3+j))
299    
300    
301     if(cov(0,0).get_x()==0.&&cov(1,0).get_x()==0.&&cov(2,0).get_x()==0.)
302     {
303     ccov=new double[4];
304     vp1[0]=1.;
305     vp1[1]=0.;
306     vp1[2]=0.;
307     for(int i=0;i<2;i++){
308     for(int j=0;j<2;j++)
309     ccov[i*2+j]=cov[(i+1)*3+j].get_x();
310     }
311     n=2;
312     fait=0;
313     }
314     if(cov(0,1).get_x()==0.&&cov(1,1).get_x()==0.&&cov(2,1).get_x()==0.)
315     {
316     ccov=new double[4];
317     vp2[0]=0.;
318     vp2[1]=1.;
319     vp2[2]=0.;
320     for(int i=0;i<2;i++){
321     for(int j=0;j<2;j++){
322     if(j==0)
323     ccov[i*2+j]=cov[i*3+j].get_x();
324     if(j==1)
325     ccov[i*2+j]=cov[i*3+j+1].get_x();
326     }
327     }
328     n=2;
329     fait=1;
330     }
331     if(cov(0,2).get_x()==0.&&cov(1,2).get_x()==0.&&cov(2,2).get_x()==0.)
332     {
333     ccov=new double[4];
334     vp3[0]=0.;
335     vp3[1]=0.;
336     vp3[2]=1.;
337    
338     for(int i=0;i<2;i++){
339     for(int j=0;j<2;j++)
340     ccov[i*2+j]=cov[i*3+j].get_x();
341     }
342     n=2;
343     fait=2;
344     }
345    
346     if(fait==-1)
347     {
348     ccov=new double[9];
349     for(int i=0;i<3;i++){
350     for(int j=0;j<3;j++)
351     ccov[i*3+j]=cov[i*3+j].get_x();
352     }
353     fait=3;
354     n=3;
355     }
356    
357     double* v=new double[n*n]; //matrice vect_ppre
358     double* d=new double[n]; //val_ppre
359    
360     m_cov.jacobi(ccov,d,v,n,nrot);
361    
362     switch(fait)
363     {
364     case 0: {
365     vp2[0]= 0;vp2[1]= v[0];vp2[2]= v[2];
366     vp3[0]= 0;vp3[1]= v[1];vp3[2]= v[3];
367     break;
368     }
369     case 1: {
370     vp1[0]= v[0];vp1[1]=0 ;vp1[2]= v[2];
371     vp3[0]= v[1];vp3[1]=0 ;vp3[2]= v[3];
372     break;
373     }
374     case 2: {
375     vp1[0]= v[0];vp1[1]=v[2] ;vp1[2]= 0;
376     vp2[0]= v[1];vp2[1]=v[3] ;vp2[2]= 0;
377     break;
378     }
379     default: {
380     vp1[0]= v[0];vp1[1]=v[3] ;vp1[2]=v[6];
381     vp2[0]= v[1];vp2[1]=v[4] ;vp2[2]=v[7];
382     vp3[0]= v[2];vp3[1]=v[5] ;vp3[2]=v[8];
383     break;
384     }
385    
386     }
387    
388     for(int idx=0;idx<3;idx++)
389     {
390     if(fabs(vp1[idx])<0.01) vp1[idx]=0;
391     if(fabs(vp2[idx])<0.01) vp2[idx]=0;
392     if(fabs(vp3[idx])<0.01) vp3[idx]=0;
393     }
394    
395    
396     delete[]d;
397     delete[]v;
398     delete[]ccov;
399     # undef cov
400    
401     }
402    
403    
404    
405     void VCT_FACE:: get_tenseur_inertie_au_cm(double2* tens) //repere globale
406     {
407     // inertie calculé dans le repere globale
408     double2 cov[9] ;
409     get_covariance(cov) ;
410     for(int i=0;i<9;i++) tens[i]=-1*cov[i]*nb_topo_points;
411    
412     tens[0]=(cov[4]+cov[8])*nb_topo_points;
413     tens[4]=(cov[0]+cov[8])*nb_topo_points;
414     tens[8]=(cov[0]+cov[4])*nb_topo_points;
415    
416     }
417    
418    
419     void VCT_FACE:: get_tenseur_inertie_au_pt(double2* xyz, double2* tens)
420     {
421     double2 tens1[9];
422     double2 centre_de_masse[4] ;
423     get_tenseur_inertie_au_cm(tens1);
424    
425     double2 a=xyz[0]-centre_de_masse[0] ;
426     double2 b=xyz[1]-centre_de_masse[1] ;
427     double2 c=xyz[2]-centre_de_masse[2] ;
428    
429     tens[0]=tens1[0]+b*b+c*c;
430     tens[4]=tens1[0]+a*a+c*c;
431     tens[8]=tens1[0]+a*a+b*b;
432    
433     tens[1]=tens1[0]-a*b;
434     tens[2]=tens1[0]-a*c;
435     tens[3]=tens1[1];
436     tens[5]=tens1[0]-b*c;
437     tens[6]=tens1[2];
438     tens[7]=tens1[5];
439    
440     }
441    
442    
443     void VCT_FACE::get_tenseur_inertie_base_locale(double2* tens_loc)
444     {
445     // inertie calculé dans le repere globale
446     OT_VECTEUR_3D v1,v2, v3 ;
447     double2 cov[9] ;
448     double2 tens_glo[9] ;
449     double I_GLOB[9];
450    
451     get_axes_dinertie(v1,v2,v3);
452     get_tenseur_inertie_au_cm(tens_glo);
453     for(int i=0;i<9;i++)
454     {
455     double2 val=tens_glo[i];
456     I_GLOB[i]= val.get_x();
457     }
458     OT_MATRICE_3D P(v1,v2,v3),I(I_GLOB),Pt,ILOC;
459     Pt=P.inverse();
460    
461     ILOC=Pt*I;
462     ILOC=ILOC*P;
463    
464    
465     for(int i=0;i<3;i++) {
466     for(int j=0;j<3;j++) {
467    
468     tens_loc[i*3+j]=ILOC(i,j); }
469    
470     }
471    
472     }
473    
474    
475    
476    
477     void VCT_FACE::get_tenseur_inertie_prprt_face( double2* g1g2,double2* tens2,const VCT_FACE& vct_f)
478     {
479     OT_VECTEUR_3D v1,v2,v3,w1,w2,w3,G1G2;
480    
481     double2 Iw[9];
482     double Iww[9];
483     double2 G1[4];
484     double2 G2[4];
485    
486     this->get_axes_dinertie(v1,v2,v3);
487     vct_f.get_axes_dinertie(w1,w2,w3);
488     OT_MATRICE_3D P(v1,v2,v3),pt,IV;
489     OT_MATRICE_3D Q(w1,w2,w3),qt,R,Rt;
490     pt=P.inverse();
491     qt=Q.inverse();
492     R=pt*Q;
493     Rt=qt*P;
494     vct_f.get_tenseur_inertie_base_locale(Iw);
495    
496     for(int i=0;i<9;i++)
497     {
498     double2 val=Iw[i];
499     Iww[i]= val.get_x();
500     }
501    
502     OT_MATRICE_3D IW(Iww);
503     IV=R*IW;
504     IV=IV*Rt;
505    
506    
507    
508    
509     this->get_topo_barycentre(G1);
510     vct_f.get_topo_barycentre(G2);
511     for(int i=0;i<3;i++)
512     {
513     G1G2[i]=G2[i].get_x()-G1[i].get_x();
514     }
515    
516     OT_VECTEUR_3D G1G2_loc=pt*G1G2;
517    
518     for(int i=0;i<3;i++)
519     {
520     g1g2[i]=G1G2_loc[i];
521     }
522    
523     OT_MATRICE_3D I_CONC;
524    
525     I_CONC(0,0)=nb_topo_points*(G1G2_loc[1]*G1G2_loc[1]+G1G2_loc[2]*G1G2_loc[2]);
526     I_CONC(0,1)=-1*nb_topo_points*(G1G2_loc[0]*G1G2_loc[1]);
527     I_CONC(0,2)=-1*nb_topo_points*(G1G2_loc[0]*G1G2_loc[2]);
528     I_CONC(1,0)=-1*nb_topo_points*(G1G2_loc[0]*G1G2_loc[1]);
529     I_CONC(1,1)=nb_topo_points*(G1G2_loc[0]*G1G2_loc[0]+G1G2_loc[2]*G1G2_loc[2]);
530     I_CONC(1,2)=-1*nb_topo_points*(G1G2_loc[1]*G1G2_loc[2]);
531     I_CONC(2,0)=-1*nb_topo_points*(G1G2_loc[0]*G1G2_loc[2]);
532     I_CONC(2,1)=-1*nb_topo_points*(G1G2_loc[1]*G1G2_loc[2]);
533     I_CONC(2,2)=nb_topo_points*(G1G2_loc[0]*G1G2_loc[0]+G1G2_loc[1]*G1G2_loc[1]);
534    
535     IV=IV+I_CONC;
536    
537     for(int i=0;i<3;i++)
538     for(int j=0;j<3;j++) {
539     tens2[i*3+j]=IV(i,j);
540     }
541    
542    
543    
544    
545     }
546    
547    
548    
549    
550    
551    
552    
553    
554    
555    
556    
557    
558     ostream& operator <<(ostream& os,const VCT_FACE& vct_f)
559     {
560     vct_f.enregistrer(os) ;
561     return os;
562     }
563    
564     //==========================================================================
565     //Visualisation
566     //==========================================================================
567    
568    
569    
570    
571    
572    
573     void VCT_FACE::enregistrer(std::ostream& ost)
574     {
575    
576     double2 cmasse[4];
577    
578     //ost<<"__FACE "<<((MG_FACE*)elem_topo)->get_id()<< endl;
579     vct_surf->enregistrer(ost);
580    
581    
582     int nb_boucle=((MG_FACE*)elem_topo)->get_nb_mg_boucle();
583    
584     for(int j=0;j<nb_boucle;j++)
585     {
586     MG_BOUCLE* Boucle = ((MG_FACE*)elem_topo)->get_mg_boucle(j);
587     int nb_arete = Boucle->get_nb_mg_coarete();
588     for (int w =0; w<nb_arete;w++)
589     {
590     vector<double2> temp_vct;
591     MG_COARETE* coArete = Boucle->get_mg_coarete(w);
592     MG_ARETE* Arete = coArete->get_arete();
593     VCT_ARETE vct_art(Arete);
594     vct_art.enregistrer(ost);
595    
596     }
597     }
598    
599    
600     ost<<setfill('=')<<setw(99)<<'='<<endl;
601    
602     get_topo_barycentre(cmasse) ;
603     ost<<"(*)"<<((MG_FACE*)elem_topo)->get_id()<<"="<<"CENTRE DE MASSE: "<<endl;
604     ost<<setfill('=')<<setw(99)<<'='<<endl;
605     for(unsigned int i=0;i<4;i++)
606     {
607     ost<<setfill(' ')<<setw(15)<<cmasse[i]<<endl;
608     }
609     /*ost<<setfill('=')<<setw(99)<<'='<<endl;
610     double2 inert_cm=get_inertie_au_centre_de_masse();
611     ost<<"(*)"<<((MG_FACE*)elem_topo)->get_id()<<"="<<"INERTIE AU CM: "<<endl;
612     ost<<setfill('=')<<setw(99)<<'='<<endl;
613     ost<< inert_cm<<endl; */
614    
615     double2 cov[9];
616     ost<<setfill('=')<<setw(99)<<'='<<endl;
617     get_covariance(cov) ;
618     ost<<((MG_FACE*)elem_topo)->get_id()<<"="<<"MATRICE DE COV: "<<endl;
619     ost<<setfill('=')<<setw(99)<<'='<<endl;
620     for(unsigned int i=0;i<3;i++)
621     {
622     for(unsigned int j=0;j<3;j++)
623    
624     ost<<setfill(' ')<<setw(15)<<cov[3*i+j] ;
625     ost<<endl;
626     }
627     ost<<setfill('=')<<setw(99)<<'='<<endl;
628     OT_VECTEUR_3D v1,v2,v3;
629     ost<<"AXES D INERTIE: "<<endl;
630     ost<<setfill('=')<<setw(99)<<'='<<endl;
631     get_axes_dinertie(v1,v2,v3) ;
632     for(unsigned int j=0;j<3;j++)
633     ost<<setfill(' ')<<setw(15)<<v1[j]<<setw(15)<<v2[j]<<setw(15)<<v3[j]<<endl;
634    
635     /*
636     ost<<"(*)"<<((MG_FACE*)elem_topo)->get_id()<<"="<<"TENS D INERTIE: "<<endl;
637    
638     ost<<setfill('=')<<setw(99)<<'='<<endl;
639     get_tenseur_inertie_au_cm(tens) ;
640     ost<<setfill('=')<<setw(99)<<'='<<endl;
641     for(unsigned int i=0;i<3;i++) {
642     for(unsigned int j=0;j<3;j++)
643     ost<<setfill(' ')<<setw(15)<<tens[3*i+j] ;
644     ost<<endl; }
645    
646     ost<<setfill('=')<<setw(99)<<'='<<endl;*/
647    
648     ost<<setfill('=')<<setw(99)<<'='<<endl;
649     double2 tens[9];
650     get_tenseur_inertie_base_locale(tens);
651    
652     ost<<((MG_FACE*)elem_topo)->get_id()<<"="<<"TENS D INERTIE LOCALE: "<<endl;
653    
654    
655     ost<<setfill('=')<<setw(99)<<'='<<endl;
656     for(unsigned int i=0;i<3;i++) {
657     for(unsigned int j=0;j<3;j++)
658     ost<<setfill(' ')<<setw(15)<<tens[3*i+j] ;
659     ost<<endl; }
660    
661     ost<<setfill('=')<<setw(99)<<'='<<endl;
662     int nbpts=LISTE_POINTS_CTRS.size();
663     int cmpt=0;
664     for(int i=0;i<nbpts;i++)
665     {
666     ost<<setfill(' ')<<setw(15)<<LISTE_POINTS_CTRS[i] ;
667     cmpt++;
668     if(cmpt==4)
669     {
670     ost<<endl;
671     cmpt=0;
672     }
673    
674     }
675     ost<<setfill('=')<<setw(99)<<'='<<endl;
676     }
677    
678    
679     /***********
680     void VCT_FACE::enregistrer(std::ostream& ost)
681     {
682    
683     double2 cmasse[4];
684    
685     vct_surf->enregistrer(ost);
686    
687     OT_TNS<double2,4> tns1,tns2;
688    
689    
690    
691     int compt=0;
692     //ost<<setfill('=')<<setw(99)<<'='<<endl;
693     int taille= LISTE_TOPO_VECTEUR_FACE.size();
694     for(int i=0;i<taille;i++)
695     {
696     ost<<LISTE_TOPO_VECTEUR_FACE[i]<<setw(18);
697     compt++;
698     if (compt==4) {compt=0; ost<<endl; }
699     }
700     int nb_boucle=((MG_FACE*)elem_topo)->get_nb_mg_boucle();
701    
702     for(int j=0;j<nb_boucle;j++)
703     {
704     MG_BOUCLE* Boucle = ((MG_FACE*)elem_topo)->get_mg_boucle(j);
705     int nb_arete = Boucle->get_nb_mg_coarete();
706     for (int w =0; w<nb_arete;w++)
707     {
708     vector<double2> temp_vct;
709     MG_COARETE* coArete = Boucle->get_mg_coarete(w);
710     MG_ARETE* Arete = coArete->get_arete();
711     VCT_ARETE vct_art(Arete);
712     vct_art.enregistrer(ost);
713    
714     }
715     }
716    
717     ost<<"TENSEUR METRIQUE FACES"<<endl;
718     tns1=get_tenseur_metrique_surface();
719     ost<<tns1<<endl;
720     ost<<"TENSEUR METRIQUE ARETES"<<endl;
721     tns2=get_tenseur_metrique_aretes();
722     ost<<tns2<<endl;
723    
724     /*
725     char* sld_file= "C:\\temp\\cb1.SLDPRT";
726     SLD_FONCTION f_sld;
727     CComPtr <ISldWorks> swApp;
728     CComPtr <IModelDoc2> swModel;
729     CComQIPtr<IPartDoc> swPart;
730     CComQIPtr<ISketchPoint> swSkPoint;
731     CComQIPtr<ISketchSegment> swSksegm;
732    
733     f_sld.Connection();
734     f_sld.OuvrirFichier(sld_file);
735    
736     swApp = f_sld.swApp;
737     swModel=f_sld.swModel;
738     swPart = swModel;
739    
740     CComVariant vBodyArr;
741     swPart->GetBodies2(swSolidBody, VARIANT_TRUE, &vBodyArr);
742    
743     SAFEARRAY* psaBody = V_ARRAY(&vBodyArr);
744     LPDISPATCH* pBodyDispArray = NULL;
745     long nBodyHighIndex = -1;
746     long nBodyCount = -1;
747     SafeArrayAccessData(psaBody, (void **) &pBodyDispArray);
748     SafeArrayGetUBound(psaBody, 1, &nBodyHighIndex);
749     nBodyCount = nBodyHighIndex + 1;
750     /* for (int i = 0; i < nBodyCount; i++)
751     {
752     CComQIPtr <IBody2> pBody;
753     pBody = pBodyDispArray[i];
754     CComPtr <IFace2> face;
755     CComPtr <IFace2> suivantface;
756     CComPtr <ISurface> surf;
757     long nbFaces;
758     pBody->GetFaceCount(&nbFaces);
759     pBody->IGetFirstFace(&face);
760    
761     for(int f=0;f<nbFaces;f++)// boucle sur les faces
762     {
763    
764     CComPtr <ILoop2> loope;
765     CComPtr <ILoop2> nextloope;
766     face->IGetFirstLoop(&loope);
767     long nbloop = -1;
768     face->GetLoopCount(&nbloop);
769     for (int l = 0;l<nbloop;l++)
770     {
771     // maintenant les aretes
772     CComPtr <ICoEdge> Coarete;
773     CComPtr <ICoEdge> nextCoarete;
774     loope->IGetFirstCoEdge(&Coarete);
775     long nbCoarete = -1;
776     loope->GetEdgeCount(&nbCoarete);
777     for (int coa=0;coa<nbCoarete;coa++)
778     {
779     CComPtr <IEdge> arete;
780     Coarete->IGetEdge(&arete);
781     swModel->SetAddToDB(1);
782     swModel->Insert3DSketch2(0);
783     double x1=0;
784     double y1=0.002;
785     double z1=0.01;
786     double x2=0;
787     double y2=0.002;
788     double z2=0.02;
789    
790    
791    
792     //=======================
793     CComPtr <IVertex> Sommet1;
794     CComPtr <IVertex> Sommet2;
795    
796     arete->IGetStartVertex(&Sommet1);
797     arete->IGetEndVertex(&Sommet2);
798    
799    
800    
801     //=======================
802    
803    
804     swModel->ICreatePoint2(x1,y1,z1);
805     swModel->ICreatePoint2(x2,y2,z2);
806     swModel->ICreateLine2(x1,y1,z1,x2,y2,z2);
807    
808     swModel->SetAddToDB(0);
809     swModel->Insert3DSketch2(1);
810     Coarete->IGetNext(&nextCoarete);
811     Coarete = nextCoarete;
812     nextCoarete.Release();
813     } // next CoEdge
814    
815     loope->IGetNext(&nextloope);
816     loope = nextloope;
817    
818    
819     } // next loop
820    
821     face->IGetNextFace(&suivantface);
822     face = suivantface;
823    
824     } // next face
825    
826    
827     } // next body /
828     //Set swSkPoint = swmodel.CreatePoint2(param(j - 2), param(j - 1), param(j))
829     // set swSketchSeg2 = swmodel.CreateLine2(paramm(3 * r * numu + 3 * s), paramm(3 * r * numu + 3 * s + 1), paramm(3 * r * numu + 3 * s + 2), paramm(3 * r * numu + 3 * (s + 1)), paramm(3 * r * numu + 3 * (s + 1) + 1), paramm(3 * r * numu + 3 * (s + 1) + 2))
830     swModel->SetAddToDB(1);
831     swModel->Insert3DSketch2(0);
832     for(int i=0;i<nb_topo_points;i++)
833     {
834     double x1=0.001*LISTE_POINTS_CTRS.get(4*i);
835     double y1=0.001*LISTE_POINTS_CTRS.get(4*i+1);
836     double z1=0.001*LISTE_POINTS_CTRS.get(4*i+2);
837     swModel->ICreatePoint2(x1,y1,z1);
838     }
839    
840     swModel->SetAddToDB(0);
841     swModel->Insert3DSketch2(1);
842    
843    
844    
845    
846    
847     } **************/
848    
849    
850    
851    
852    
853    
854