MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
vct_comparaison.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// vct_comparaison.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:56 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #include"gestionversion.h"
23 
24 #pragma hdrstop
25 #include <string.h>
26 #include "vct_comparaison.h"
27 #include "vct_volume.h"
28 #include "vct_face.h"
29 #include "vct_surface.h"
30 #include <iomanip>
31 #include "vct_outils.h"
32 #include "constantegeo.h"
33 #include "mg_geometrie_outils.h"
34 #include "ot_cpu.h"
35 
36 
37 #pragma package(smart_init)
38 
39 
40 VCT_COMPARAISON::VCT_COMPARAISON(MG_GESTIONNAIRE *gst1,MG_GEOMETRIE *mgeo1,MG_GESTIONNAIRE *gst2,MG_GEOMETRIE *mgeo2):mggeo1(mgeo1),mggeo2(mgeo2),gest1(gst1),gest2(gst2),affichageactif(0)
41 {
46 }
47 
49 {
50 }
51 
52 void VCT_COMPARAISON::active_affichage(void (*fonc)(char*))
53 {
54  affiche=fonc;
56 }
57 
58 
60 {
61  if (vol1==NULL) vol1=mggeo1->get_mg_volume(0);
62  if (vol2==NULL) vol2=mggeo2->get_mg_volume(0);
63  if (affichageactif==1)
64  {
65  #ifndef USE_ENGLISH
66  char mess[300];
67  sprintf(mess," Fichier 1 : %d faces",mggeo1->get_nb_mg_face());
68  affiche((char*)mess);
69  sprintf(mess," Fichier 2 : %d faces",mggeo2->get_nb_mg_face());
70  affiche((char*)mess);
71  affiche((char*)" Recherche de similarité");
72  #else
73  char mess[300];
74  sprintf(mess," File A : %d faces",mggeo1->get_nb_mg_face());
75  affiche((char*)mess);
76  sprintf(mess," File B : %d faces",mggeo2->get_nb_mg_face());
77  affiche((char*)mess);
78  affiche((char*)" Similar faces research");
79  #endif
80  }
82  #ifndef USE_ENGLISH
83  if (cpu!=NULL) cpu->ajouter_etape("Similarite");
84  if (affichageactif==1)
85  {
86  char mess[300];
87  sprintf(mess," Nombre de paires de faces similaires : %d",similarite.get_nb()/2);
88  affiche((char*)mess);
89  affiche((char*)" Recherche d'identite");
90  }
91  #else
92  if (cpu!=NULL) cpu->ajouter_etape("Similar faces");
93  if (affichageactif==1)
94  {
95  char mess[300];
96  sprintf(mess," Number of similar faces : %d",similarite.get_nb()/2);
97  affiche((char*)mess);
98  affiche((char*)" Identical faces reseach");
99  }
100  #endif
101  trouve_identite();
102  #ifndef USE_ENGLISH
103  if (cpu!=NULL) cpu->ajouter_etape("Identite");
104  if (affichageactif==1)
105  {
106  char mess[300];
107  sprintf(mess," Nombre de paires de faces identiques : %d",identite.get_nb()/2);
108  affiche((char*)mess);
109  affiche((char*)" Recherche de localisation");
110  }
111  #else
112  if (cpu!=NULL) cpu->ajouter_etape("Identical faces");
113  if (affichageactif==1)
114  {
115  char mess[300];
116  sprintf(mess," Nunber of identical faces : %d",identite.get_nb()/2);
117  affiche((char*)mess);
118  affiche((char*)" Localized faces research");
119  }
120  #endif
121  trouve_localise(cmp);
122  #ifndef USE_ENGLISH
123  if (cpu!=NULL) cpu->ajouter_etape("Localisation");
124  if (affichageactif==1)
125  {
126  char mess[300];
127  sprintf(mess," Face de reference 1 : %lu ",cmp.get_face_reference1()->get_id());
128  affiche((char*)mess);
129  sprintf(mess," Face de reference 2 : %lu ",cmp.get_face_reference2()->get_id());
130  affiche((char*)mess);
131  sprintf(mess," Matrice de changement de repere : %lf %lf %lf %lf",transformation(0,0).get_x(),transformation(0,1).get_x(),transformation(0,2).get_x(),transformation(0,3).get_x());
132  affiche((char*)mess);
133  sprintf(mess," : %lf %lf %lf %lf",transformation(1,0).get_x(),transformation(1,1).get_x(),transformation(1,2).get_x(),transformation(1,3).get_x());
134  affiche((char*)mess);
135  sprintf(mess," R1 vers R2 : %lf %lf %lf %lf",transformation(2,0).get_x(),transformation(2,1).get_x(),transformation(2,2).get_x(),transformation(2,3).get_x());
136  affiche((char*)mess);
137  sprintf(mess," : %lf %lf %lf %lf",transformation(3,0).get_x(),transformation(3,1).get_x(),transformation(3,2).get_x(),transformation(3,3).get_x());
138  affiche((char*)mess);
139 
140  sprintf(mess," Nombre de paires de faces localisées : %d",localise.get_nb()/2);
141  affiche((char*)mess);
142  affiche((char*)" Recherche des arêtes et des sommets correspondants");
143  }
144  #else
145  if (cpu!=NULL) cpu->ajouter_etape("Localized faces");
146  if (affichageactif==1)
147  {
148  char mess[300];
149  sprintf(mess," Reference face A : %lu ",cmp.get_face_reference1()->get_id());
150  affiche((char*)mess);
151  sprintf(mess," Reference face B : %lu ",cmp.get_face_reference2()->get_id());
152  affiche((char*)mess);
153  sprintf(mess," Transfom matrix : %lf %lf %lf %lf",transformation(0,0).get_x(),transformation(0,1).get_x(),transformation(0,2).get_x(),transformation(0,3).get_x());
154  affiche((char*)mess);
155  sprintf(mess," : %lf %lf %lf %lf",transformation(1,0).get_x(),transformation(1,1).get_x(),transformation(1,2).get_x(),transformation(1,3).get_x());
156  affiche((char*)mess);
157  sprintf(mess," RA to RB : %lf %lf %lf %lf",transformation(2,0).get_x(),transformation(2,1).get_x(),transformation(2,2).get_x(),transformation(2,3).get_x());
158  affiche((char*)mess);
159  sprintf(mess," : %lf %lf %lf %lf",transformation(3,0).get_x(),transformation(3,1).get_x(),transformation(3,2).get_x(),transformation(3,3).get_x());
160  affiche((char*)mess);
161 
162  sprintf(mess," Number of localized faces : %d",localise.get_nb()/2);
163  affiche((char*)mess);
164  affiche((char*)" Vertices and egdes correspondense research ");
165  }
166  #endif
168  #ifndef USE_ENGLISH
169  if (cpu!=NULL) cpu->ajouter_etape("Correspondance");
170  if (affichageactif==1) affiche((char*)" Recherche des modifications partielles");
171  if (affichageactif==1)
172  {
173  char mess[300];
174  sprintf(mess," Nombre de paires de sommets localisés : %d",sommetparfait);
175  affiche((char*)mess);
176  sprintf(mess," Nombre de paires d'aretes localisées : %d",areteparfait);
177  affiche((char*)mess);
178  }
179  #else
180  if (cpu!=NULL) cpu->ajouter_etape("Correspondence");
181  if (affichageactif==1) affiche((char*)" Partial modification research");
182  if (affichageactif==1)
183  {
184  char mess[300];
185  sprintf(mess," Number of localized vertices : %d",sommetparfait);
186  affiche((char*)mess);
187  sprintf(mess," Number of localized edges : %d",areteparfait);
188  affiche((char*)mess);
189  }
190  #endif
192  #ifndef USE_ENGLISH
193  if (cpu!=NULL) cpu->ajouter_etape("Modifications partielles");
194  if (affichageactif==1)
195  {
196  char mess[300];
197  sprintf(mess," Nombre de paires de sommets : %d",sommetpartiel);
198  affiche((char*)mess);
199  sprintf(mess," Nombre de paires d'aretes : %d",aretepartiel);
200  affiche((char*)mess);
201  sprintf(mess," Nombre de paires de faces : %d",facepartiel);
202  affiche((char*)mess);
203  }
204  #else
205  if (cpu!=NULL) cpu->ajouter_etape("Partial modification");
206  if (affichageactif==1)
207  {
208  char mess[300];
209  sprintf(mess," Partial modification vectices : %d",sommetpartiel);
210  affiche((char*)mess);
211  sprintf(mess," Partial modification edges : %d",aretepartiel);
212  affiche((char*)mess);
213  sprintf(mess," Partial modification faces : %d",facepartiel);
214  affiche((char*)mess);
215  }
216  #endif
217 
218 }
219 
220 
221 
223 {
224  int nb_face1=mggeo1->get_nb_mg_face();
225  int nb_face2=mggeo2->get_nb_mg_face();
226  similarite.vide();
227  for (int i=0;i<nb_face1; i++)
228  {
229  MG_FACE* face1=mggeo1->get_mg_face(i);
230  MG_SURFACE*surf1=face1->get_surface();
231  int nb_top1_pts= face1->get_vectorisation().get_nb_points();
232  int nb_geo1_pts= surf1->get_vectorisation().get_nb_points();
233 
234  OT_TENSEUR *tns1_face=face1->get_vectorisation().get_tenseur_metrique();
235  OT_TENSEUR *tns1_surf=surf1->get_vectorisation().get_tenseur_metrique();
236  for (int j=0;j<nb_face2;j++)
237  {
238  MG_FACE* face2=mggeo2->get_mg_face(j);
239  MG_SURFACE*surf2=face2->get_surface();
240  int nb_top2_pts= face2->get_vectorisation().get_nb_points();
241  int nb_geo2_pts= surf2->get_vectorisation().get_nb_points();
242  OT_TENSEUR* tns2_face=face2->get_vectorisation().get_tenseur_metrique();
243  OT_TENSEUR* tns2_surf=surf2->get_vectorisation().get_tenseur_metrique();
244  if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts)
245  {
246  if (tns1_face->est_til_equivalent(*tns2_face))
247  {
248  if (tns1_surf->est_til_equivalent(*tns2_surf))
249  {
250  similarite.ajouter(face1->get_id());
251  similarite.ajouter(face2->get_id());
252  }
253  }
254  }
255  }
256  }
257 }
258 
260 {
261  identite.vide();
262  int nbpaire=similarite.get_nb()/2;
263  for (int i=0;i<nbpaire;i++)
264  {
265  MG_FACE* face1=mggeo1->get_mg_faceid(similarite.get(2*i));
266  MG_SURFACE*surf1=face1->get_surface();
267  MG_FACE* face2=mggeo2->get_mg_faceid(similarite.get(2*i+1));
268  MG_SURFACE*surf2=face1->get_surface();
273  if (tns1_face->est_til_equivalent(*tns2_face))
274  if (tns1_surf->est_til_equivalent(*tns2_surf))
275  {
276  identite.ajouter(face1->get_id());
277  identite.ajouter(face2->get_id());
278  }
279  }
280 }
282 {
283 
284  localise.vide();
285  TPL_LISTE_ENTITE<int> localisetmp;
286  int nbpaire=identite.get_nb()/2.;
287  if (nbpaire==0)
288  {
289  OT_TENSEUR tmp(4,4);
290  tmp.identite();
291  transformation=tmp;
293  return;
294  }
295  int *paire=new int[nbpaire];
296  for (int i=0;i<nbpaire;i++)
297  paire[i]=0;
298  for (int ident=0;ident<nbpaire;ident++)
299  {
300  if (paire[ident]==1) continue;
301  MG_FACE* faceref1=mggeo1->get_mg_faceid(identite.get(2*ident));
302  MG_FACE* faceref2=mggeo2->get_mg_faceid(identite.get(2*ident+1));
303  OT_TENSEUR tnsref1(3,3);
304  OT_TENSEUR tnsref2(3,3);
305  std::vector<OT_TENSEUR> list;
306  recale_repere_reference(faceref1,faceref2,list);
307  int nbessai=list.size()/2;
308  for (int essai=0;essai<nbessai;essai++)
309  {
310  localisetmp.vide();
311  int *pairetmp=new int[nbpaire];
312  for (int i=0;i<nbpaire;i++)
313  pairetmp[i]=0;
314  OT_VECTEUR_3DD *baryref1=faceref1->get_vectorisation().get_barycentre_3d();
315  OT_VECTEUR_3DD *baryref2=faceref2->get_vectorisation().get_barycentre_3d();
316  OT_TENSEUR tnsref1=list[essai*2];
317  OT_TENSEUR tnsref2=list[essai*2+1];
318  OT_TENSEUR tnsrefinv1=tnsref1.transpose();
319  OT_TENSEUR tnsrefinv2=tnsref2.transpose();
320  for (int i=0;i<nbpaire;i++)
321  {
322  MG_FACE* face1=mggeo1->get_mg_faceid(identite.get(2*i));
323  MG_FACE* face2=mggeo2->get_mg_faceid(identite.get(2*i+1));
325  OT_TENSEUR trans1=tns1->transpose();
326  trans1=trans1*tnsref1;
327  OT_TENSEUR tns2=trans1.transpose();
328  tns2=tnsref2*tns2;
331  OT_TENSEUR inerloc2prime=tns2.transpose();
332  inerloc2prime=inerloc2prime*(*iner2);
333  inerloc2prime=inerloc2prime*tns2;
335  OT_VECTEUR_3DD baryloc1=(*bary1)-(*baryref1);
336  baryloc1=tnsrefinv1*baryloc1;
338  OT_VECTEUR_3DD baryloc2=(*bary2)-(*baryref2);
339  baryloc2=tnsrefinv2*baryloc2;
340  if (inerloc2prime.est_til_equivalent(*inerloc2))
341  if (baryloc1==baryloc2)
342  {
343  localisetmp.ajouter(face1->get_id());
344  localisetmp.ajouter(face2->get_id());
345  pairetmp[i]=1;
346  }
347  }
348  if (localisetmp.get_nb()>localise.get_nb())
349  {
350  int n=localisetmp.get_nb();
351  localise.vide();
352  for (int i=0;i<n;i++)
353  localise.ajouter(localisetmp.get(i));
354  for (int i=0;i<nbpaire;i++)
355  paire[i]=pairetmp[i];
356  ident=0;
357  transformation=calcul_transformation(*baryref1,*baryref2,tnsref1,tnsref2);
358  cmp.change_face_reference1(faceref1);
359  cmp.change_face_reference2(faceref2);
360  }
361  delete [] pairetmp;
362  }
363  }
364  delete [] paire;
366  OT_VECTEUR_3D vec1(transformation(0,0).get_x(),transformation(1,0).get_x(),transformation(2,0).get_x());
367  OT_VECTEUR_3D vec2(transformation(0,1).get_x(),transformation(1,1).get_x(),transformation(2,1).get_x());
368  OT_VECTEUR_3D vec3(transformation(0,2).get_x(),transformation(1,2).get_x(),transformation(2,2).get_x());
369  OT_VECTEUR_3D vec4(transformation(0,3).get_x(),transformation(1,3).get_x(),transformation(2,3).get_x());
370  cmp.initialise_changement_repere(vec1,vec2,vec3,vec4);
371  for (int i=0;i<similarite.get_nb();i++)
373  for (int i=0;i<identite.get_nb();i++)
374  cmp.ajouter_identite(identite.get(i));
375  for (int i=0;i<localise.get_nb();i++)
377 }
378 
379 
381 {
383  int nbpaire=localise.get_nb()/2.;
384  for (int i=0;i<nbpaire;i++)
385  {
386  MG_FACE* face1=mggeo1->get_mg_faceid(localise.get(2*i));
387  MG_FACE* face2=mggeo2->get_mg_faceid(localise.get(2*i+1));
388  CORRESPONDANCE cor(face1,face2,CORRESPONDANCE::PARFAITE);
389  cmp.ajouter_liste_topologie(cor);
393  }
394 
395 }
396 
397 void VCT_COMPARAISON::identifie_topologie_sous_jacente(VCT_COMPARAISON_RESULTAT &cmp,MG_FACE* face1,MG_FACE* face2,int& sommetparfait,int& areteparfait)
398 {
399  double2 UN(1.0);
400  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom1;
401  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom2;
402  std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD > tabare1;
403  std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD > tabare2;
404  int nb_boucle=face1->get_nb_mg_boucle();
405  for (int i=0;i<nb_boucle;i++)
406  {
407  MG_BOUCLE* bou1=face1->get_mg_boucle(i);
408  int nb_arete=bou1->get_nb_mg_coarete();
409  for (int j=0;j<nb_arete;j++)
410  {
411  MG_ARETE *are=bou1->get_mg_coarete(j)->get_arete();
413  std::pair<OT_VECTEUR_3DD,MG_ARETE*> tmp(*bary,are);
414  tabare1.insert(tmp);
415  MG_SOMMET *som1=are->get_cosommet1()->get_sommet();
416  double xyz[3];
417  som1->get_point()->evaluer(xyz);
418  OT_VECTEUR_3DD vec(xyz[0],xyz[1],xyz[2]);
419  std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp2(vec,som1);
420  tabsom1.insert(tmp2);
421  MG_SOMMET *som2=are->get_cosommet2()->get_sommet();
422  som2->get_point()->evaluer(xyz);
423  OT_VECTEUR_3DD vec2(xyz[0],xyz[1],xyz[2]);
424  std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp3(vec2,som2);
425  tabsom1.insert(tmp3);
426  }
427  MG_BOUCLE* bou2=face2->get_mg_boucle(i);
428  nb_arete=bou1->get_nb_mg_coarete();
429  for (int j=0;j<nb_arete;j++)
430  {
431  MG_ARETE *are=bou2->get_mg_coarete(j)->get_arete();
433  OT_VECTEUR_4DD baryhomo(bary->get_x(),bary->get_y(),bary->get_z(),UN);
434  OT_VECTEUR_4DD barytranshomo=transformation_inverse*baryhomo;
435  OT_VECTEUR_3DD barytrans(barytranshomo.get_x(),barytranshomo.get_y(),barytranshomo.get_z());
436  double2 w=UN/barytranshomo.get_w();
437  barytrans=barytrans*w;
438  std::pair<OT_VECTEUR_3DD,MG_ARETE*> tmp(barytrans,are);
439  tabare2.insert(tmp);
440  MG_SOMMET *som1=are->get_cosommet1()->get_sommet();
441  double xyz[3];
442  som1->get_point()->evaluer(xyz);
443  OT_VECTEUR_4DD vechomo(xyz[0],xyz[1],xyz[2],1.);
444  OT_VECTEUR_4DD vectranshomo=transformation_inverse*vechomo;
445  OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z());
446  w=UN/vectranshomo.get_w();
447  vectrans=vectrans*w;
448  std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp2(vectrans,som1);
449  tabsom2.insert(tmp2);
450  MG_SOMMET *som2=are->get_cosommet2()->get_sommet();
451  som2->get_point()->evaluer(xyz);
452  OT_VECTEUR_4DD vechomo2(xyz[0],xyz[1],xyz[2],1.);
453  OT_VECTEUR_4DD vectranshomo2=transformation_inverse*vechomo2;
454  OT_VECTEUR_3DD vectrans2(vectranshomo2.get_x(),vectranshomo2.get_y(),vectranshomo2.get_z());
455  w=UN/vectranshomo2.get_w();
456  vectrans2=vectrans2*w;
457  std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp3(vectrans2,som2);
458  tabsom2.insert(tmp3);
459  }
460  //arete
461  std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD >::iterator it1;
462  std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD >::iterator it2;
463  it1=tabare1.begin();
464  int ok=0;
465  if (it1==tabare1.end()) ok=1;
466  while (ok==0)
467  {
468  MG_ARETE* are1=(*it1).second;
469  OT_VECTEUR_3DD bary1=(*it1).first;
470  int nb_top1_pts= are1->get_vectorisation().get_nb_points();
471  int nb_geo1_pts= are1->get_courbe()->get_vectorisation().get_nb_points();
472  OT_TENSEUR *tns1_metrique_are=are1->get_vectorisation().get_tenseur_metrique();
473  OT_TENSEUR *tns1_metrique_crb=are1->get_courbe()->get_vectorisation().get_tenseur_metrique();
476  it2=tabare2.find(bary1);
477  int ok2=0;
478  do
479  {
480  if (it2==tabare2.end()) ok2=1;
481  else
482  {
483  MG_ARETE* are2=(*it2).second;
484  OT_VECTEUR_3DD bary2=(*it2).first;
485  if (!(bary2==bary1)) ok2=1;
486  else
487  {
488  int nb_top2_pts= are2->get_vectorisation().get_nb_points();
489  int nb_geo2_pts= are2->get_courbe()->get_vectorisation().get_nb_points();
490  OT_TENSEUR *tns2_metrique_are=are2->get_vectorisation().get_tenseur_metrique();
491  OT_TENSEUR *tns2_metrique_crb=are2->get_courbe()->get_vectorisation().get_tenseur_metrique();
494  if (nb_top1_pts==nb_top2_pts)
495  if (nb_geo1_pts==nb_geo2_pts)
496  if (tns1_metrique_are->est_til_equivalent(*tns2_metrique_are))
497  if (tns1_metrique_crb->est_til_equivalent(*tns2_metrique_crb))
498  if (tns1_inertie_are->est_til_equivalent(*tns2_inertie_are))
499  if (tns1_inertie_crb->est_til_equivalent(*tns2_inertie_crb))
500  {
502  int res=cmp.ajouter_liste_topologie(cor);
503  if (res==1)
504  {
507  cmp.ajouter_localise_arete(are1->get_id());
508  cmp.ajouter_localise_arete(are2->get_id());
509  areteparfait++;
510  }
511  }
512  it2++;
513  }
514  }
515  }
516  while (ok2==0);
517  it1++;
518  if (it1==tabare1.end()) ok=1;
519  }
520 
521  //sommet
522  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its1;
523  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its2;
524  its1=tabsom1.begin();
525  ok=0;
526  do
527  {
528  MG_SOMMET* som=(*its1).second;
529  its2=tabsom2.find((*its1).first);
530  if (its2!=tabsom2.end())
531  {
532  CORRESPONDANCE cor((*its1).second,(*its2).second,CORRESPONDANCE::PARFAITE);
533  int res=cmp.ajouter_liste_topologie(cor);
534  if (res==1)
535  {
538  cmp.ajouter_localise_sommet(((*its1).second)->get_id());
539  cmp.ajouter_localise_sommet(((*its2).second)->get_id());
540  sommetparfait++;
541  }
542  }
543  its1++;
544  if (its1==tabsom1.end()) ok=1;
545  }
546  while (ok==0);
547  }
548 }
549 
551 {
552  double2 ZERO(0.);
553  double2 UN(1.);
555  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom1;
556  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom2;
557  std::multimap<int,MG_ARETE* > tabare1;
558  std::multimap<int,MG_ARETE* > tabare2;
559  std::multimap<int,MG_FACE* > tabface1;
560  std::multimap<int,MG_FACE*> tabface2;
561 
562  LISTE_MG_SOMMET::iterator itsom;
563  LISTE_MG_ARETE::iterator itare;
564  LISTE_MG_FACE::iterator itface;
565  for (MG_SOMMET* som=mggeo1->get_premier_sommet(itsom);som!=NULL;som=mggeo1->get_suivant_sommet(itsom))
566  {
567  unsigned long num=cmp.get_liste_correspondance_modifie(som->get_id());
568  if (num==0)
569  {
570  double xyz[3];
571  som->get_point()->evaluer(xyz);
572  OT_VECTEUR_3DD vec(xyz[0],xyz[1],xyz[2]);
573  std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp(vec,som);
574  tabsom1.insert(tmp);
575  }
576  }
577  for (MG_ARETE* are=mggeo1->get_premier_arete(itare);are!=NULL;are=mggeo1->get_suivant_arete(itare))
578  {
579  unsigned long num=cmp.get_liste_correspondance_modifie(are->get_id());
580  if (num==0)
581  {
583  int typecrb=are->get_courbe()->get_type_geometrique(param);
584  std::pair<int,MG_ARETE*> tmp(typecrb,are);
585  tabare1.insert(tmp);
586  }
587  }
588  for (MG_FACE* face=mggeo1->get_premier_face(itface);face!=NULL;face=mggeo1->get_suivant_face(itface))
589  {
590  unsigned long num=cmp.get_liste_correspondance_modifie(face->get_id());
591  if (num==0)
592  {
594  int typesurf=face->get_surface()->get_type_geometrique(param);
595  std::pair<int,MG_FACE*> tmp(typesurf,face);
596  tabface1.insert(tmp);
597  }
598  }
599  for (MG_SOMMET* som=mggeo2->get_premier_sommet(itsom);som!=NULL;som=mggeo2->get_suivant_sommet(itsom))
600  {
601  unsigned long num=cmp.get_liste_correspondance_origine(som->get_id());
602  if (num==0)
603  {
604  double xyz[3];
605  som->get_point()->evaluer(xyz);
606  OT_VECTEUR_4DD vec(xyz[0],xyz[1],xyz[2],1.);
607  OT_VECTEUR_4DD vectranshomo=transformation_inverse*vec;
608  OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z());
609  double2 w=UN/vectranshomo.get_w();
610  vectrans=vectrans*w;
611  std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp(vectrans,som);
612  tabsom2.insert(tmp);
613  }
614  }
615  for (MG_ARETE* are=mggeo2->get_premier_arete(itare);are!=NULL;are=mggeo2->get_suivant_arete(itare))
616  {
617  unsigned long num=cmp.get_liste_correspondance_origine(are->get_id());
618  if (num==0)
619  {
621  int typecrb=are->get_courbe()->get_type_geometrique(param);
622  std::pair<int,MG_ARETE*> tmp(typecrb,are);
623  tabare2.insert(tmp);
624  }
625  }
626  for (MG_FACE* face=mggeo2->get_premier_face(itface);face!=NULL;face=mggeo2->get_suivant_face(itface))
627  {
628  unsigned long num=cmp.get_liste_correspondance_origine(face->get_id());
629  if (num==0)
630  {
632  int typesurf=face->get_surface()->get_type_geometrique(param);
633  std::pair<int,MG_FACE*> tmp(typesurf,face);
634  tabface2.insert(tmp);
635  }
636  }
637  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its1;
638  std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its2;
639  its1=tabsom1.begin();
640  int ok=0;
641  if (tabsom1.size()==0) ok=1;
642  while (ok==0)
643  {
644  its2=tabsom2.find((*its1).first);
645  if (its2!=tabsom2.end())
646  {
647  CORRESPONDANCE cor((*its1).second,(*its2).second,CORRESPONDANCE::MODIFIE);
648  cmp.ajouter_liste_topologie(cor);
651  sommetpartiel++;
652  }
653  its1++;
654  if (its1==tabsom1.end()) ok=1;
655  }
656  std::multimap<int,MG_ARETE* >::iterator ita1;
657  std::multimap<int,MG_ARETE* >::iterator ita2;
658  ita1=tabare1.begin();
659  ok=0;
660  if (tabare1.size()==0) ok=1;
661  while (ok==0)
662  {
663  MG_ARETE* are1=(*ita1).second;
664  int typecrb1=(*ita1).first;
665  int nb_geo1_pts= are1->get_courbe()->get_vectorisation().get_nb_points();
666  OT_TENSEUR *tns1_metrique_crb=are1->get_courbe()->get_vectorisation().get_tenseur_metrique();
668  ita2=tabare2.find(typecrb1);
669  int ok2=0;
670  do
671  {
672  if (ita2==tabare2.end()) ok2=1;
673  else
674  {
675  MG_ARETE* are2=(*ita2).second;
676  int typecrb2=(*ita2).first;
677  if (!(typecrb2==typecrb1)) ok2=1;
678  else
679  {
680  int nb_geo2_pts= are2->get_courbe()->get_vectorisation().get_nb_points();
681  OT_TENSEUR *tns2_metrique_crb=are2->get_courbe()->get_vectorisation().get_tenseur_metrique();
683  if (nb_geo1_pts==nb_geo2_pts)
684  if (tns1_metrique_crb->est_til_equivalent(*tns2_metrique_crb))
685  if (tns1_inertie_crb->est_til_equivalent(*tns2_inertie_crb))
686  if (localise_courbe(are1->get_courbe(),are2->get_courbe()))
687  {
689  cmp.ajouter_liste_topologie(cor);
692  cmp.ajouter_modifie_arete(are1->get_id());
693  cmp.ajouter_modifie_arete(are2->get_id());
694  aretepartiel++;
695  }
696  ita2++;
697  }
698  }
699  }
700  while (ok2==0);
701  ita1++;
702  if (ita1==tabare1.end()) ok=1;
703  }
704 
705  std::multimap<int,MG_FACE* >::iterator itf1;
706  std::multimap<int,MG_FACE* >::iterator itf2;
707  itf1=tabface1.begin();
708  ok=0;
709  if (tabface1.size()==0) ok=1;
710  while (ok==0)
711  {
712  MG_FACE* face1=(*itf1).second;
713  int typefac1=(*itf1).first;
714  int nb_geo1_pts= face1->get_surface()->get_vectorisation().get_nb_points();
715  OT_TENSEUR *tns1_metrique_surface=face1->get_surface()->get_vectorisation().get_tenseur_metrique();
717  itf2=tabface2.find(typefac1);
718  int ok2=0;
719  do
720  {
721  if (itf2==tabface2.end()) ok2=1;
722  else
723  {
724  MG_FACE* face2=(*itf2).second;
725  int typefac2=(*itf2).first;
726  if (typefac1!=typefac2) ok2=1;
727  else
728  {
729  int nb_geo2_pts= face2->get_surface()->get_vectorisation().get_nb_points();
730  OT_TENSEUR *tns2_metrique_surface=face2->get_surface()->get_vectorisation().get_tenseur_metrique();
732  if (nb_geo1_pts==nb_geo2_pts)
733  //if (tns1_metrique_surface->est_til_equivalent(*tns2_metrique_surface))
734  //if (tns1_inertie_surface->est_til_equivalent(*tns2_inertie_surface))
735  if (localise_surface(face1->get_surface(),face2->get_surface()))
736  {
737  CORRESPONDANCE cor(face1,face2,CORRESPONDANCE::MODIFIE);
738  cmp.ajouter_liste_topologie(cor);
741  cmp.ajouter_modifie_face(face1->get_id());
742  cmp.ajouter_modifie_face(face2->get_id());
743  facepartiel++;
744  }
745  itf2++;
746  }
747  }
748  }
749  while (ok2==0);
750  itf1++;
751  if (itf1==tabface1.end()) ok=1;
752  }
753  for (its1=tabsom1.begin();its1!=tabsom1.end();its1++)
754  {
755  unsigned long num=cmp.get_liste_correspondance_modifie((*its1).second->get_id());
757  }
758  for (its1=tabsom2.begin();its1!=tabsom2.end();its1++)
759  {
760  unsigned long num=cmp.get_liste_correspondance_origine((*its1).second->get_id());
762  }
763  for (ita1=tabare1.begin();ita1!=tabare1.end();ita1++)
764  {
765  unsigned long num=cmp.get_liste_correspondance_modifie((*ita1).second->get_id());
767  }
768  for (ita1=tabare2.begin();ita1!=tabare2.end();ita1++)
769  {
770  unsigned long num=cmp.get_liste_correspondance_origine((*ita1).second->get_id());
772  }
773  for (itf1=tabface1.begin();itf1!=tabface1.end();itf1++)
774  {
775  unsigned long num=cmp.get_liste_correspondance_modifie((*itf1).second->get_id());
777  }
778  for (itf1=tabface2.begin();itf1!=tabface2.end();itf1++)
779  {
780  unsigned long num=cmp.get_liste_correspondance_origine((*itf1).second->get_id());
782  }
783 
784 
785 }
786 
787 
789 {
790  double xyz1[3],xyz2[3],xyz3[3],xyz[3];
791  double t=0.5*(crb2->get_tmax()+crb2->get_tmin());
792  double dt=(crb2->get_tmax()-crb2->get_tmin())/max(fabs(crb2->get_tmax()),fabs(crb2->get_tmin()));
793  crb2->evaluer(t,xyz1);
794  t=t+dt;
795  crb2->evaluer(t,xyz2);
796  t=t+dt;
797  crb2->evaluer(t,xyz3);
798  change_point_inverse(xyz1);
799  change_point_inverse(xyz2);
800  change_point_inverse(xyz3);
801  OT_VECTEUR_3D vec(xyz1,xyz3);
802  crb1->inverser(t,xyz1);
803  crb1->evaluer(t,xyz);
804  OT_VECTEUR_3D vec1(xyz,xyz1);
805  if (vec1.get_longueur()>eps) return 0;
806  crb1->inverser(t,xyz2);
807  crb1->evaluer(t,xyz);
808  OT_VECTEUR_3D vec2(xyz,xyz2);
809  if (vec2.get_longueur()>eps) return 0;
810  crb1->inverser(t,xyz3);
811  crb1->evaluer(t,xyz);
812  OT_VECTEUR_3D vec3(xyz,xyz3);
813  if (vec3.get_longueur()>eps) return 0;
814  return 1;
815 }
816 
818 {
819  double du=surf2->get_umax()-surf2->get_umin();
820  double dv=surf2->get_vmax()-surf2->get_vmin();
821  du=du/max(fabs(surf2->get_umax()),fabs(surf2->get_umin()));
822  dv=dv/max(fabs(surf2->get_vmax()),fabs(surf2->get_vmin()));
823  double ou=0.5*(surf2->get_umax()+surf2->get_umin());
824  double ov=0.5*(surf2->get_vmax()+surf2->get_vmin());
825  for (int i=0;i<3;i++)
826  for (int j=0;j<3;j++)
827  {
828  double uv[2],xyz[3];
829  uv[0]=ou+i*du;
830  uv[1]=ov+j*dv;
831  surf2->evaluer(uv,xyz);
833  double xyz1[3];
834  surf1->inverser(uv,xyz);
835  surf1->evaluer(uv,xyz1);
836  OT_VECTEUR_3D vec(xyz,xyz1);
837  if (vec.get_longueur()>eps) return 0;
838  }
839  return 1;
840 }
841 
842 
843 
845 {
846  double2 UN(1.);
847  OT_VECTEUR_4DD vec(xyz[0],xyz[1],xyz[2],1.);
848  OT_VECTEUR_4DD vectranshomo=transformation_inverse*vec;
849  OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z());
850  double2 w=UN/vectranshomo.get_w();
851  vectrans=vectrans*w;
852  xyz[0]=vectrans.get_x().get_x();
853  xyz[1]=vectrans.get_y().get_x();
854  xyz[2]=vectrans.get_z().get_x();
855 }
856 
858 {
859  double2 UN(1.);
860  OT_VECTEUR_4DD vec(xyz[0],xyz[1],xyz[2],1.);
861  OT_VECTEUR_4DD vectranshomo=transformation*vec;
862  OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z());
863  double2 w=UN/vectranshomo.get_w();
864  vectrans=vectrans*w;
865  xyz[0]=vectrans.get_x().get_x();
866  xyz[1]=vectrans.get_y().get_x();
867  xyz[2]=vectrans.get_z().get_x();
868 }
869 
870 
871 
873 {
874  double2 zero(0.),un(1.);
875  OT_TENSEUR t1(4,4);
876  t1(0,0)=tns1(0,0);
877  t1(1,0)=tns1(1,0);
878  t1(2,0)=tns1(2,0);
879  t1(3,0)=zero;
880  t1(0,1)=tns1(0,1);
881  t1(1,1)=tns1(1,1);
882  t1(2,1)=tns1(2,1);
883  t1(3,1)=zero;
884  t1(0,2)=tns1(0,2);
885  t1(1,2)=tns1(1,2);
886  t1(2,2)=tns1(2,2);
887  t1(3,2)=zero;
888  t1(0,3)=bary1.get_x();
889  t1(1,3)=bary1.get_y();
890  t1(2,3)=bary1.get_z();
891  t1(3,3)=un;
892  OT_TENSEUR t2(4,4);
893  t2(0,0)=tns2(0,0);
894  t2(1,0)=tns2(1,0);
895  t2(2,0)=tns2(2,0);
896  t2(3,0)=zero;
897  t2(0,1)=tns2(0,1);
898  t2(1,1)=tns2(1,1);
899  t2(2,1)=tns2(2,1);
900  t2(3,1)=zero;
901  t2(0,2)=tns2(0,2);
902  t2(1,2)=tns2(1,2);
903  t2(2,2)=tns2(2,2);
904  t2(3,2)=zero;
905  t2(0,3)=bary2.get_x();
906  t2(1,3)=bary2.get_y();
907  t2(2,3)=bary2.get_z();
908  t2(3,3)=un;
909  OT_TENSEUR t1inv=t1.inverse_homogene();
910  OT_TENSEUR trans=t2*t1inv;
911  return trans;
912 }
913 
914 void VCT_COMPARAISON::recale_repere_reference(MG_FACE* faceref1,MG_FACE* faceref2,vector<OT_TENSEUR> &list)
915 {
916  OT_TENSEUR tnsref1(3,3),tnsref2(3,3);
917  double2 zero(0.);
919  double xyz1[3]={bary1->get_x().get_x(),bary1->get_y().get_x(),bary1->get_z().get_x()};
921  double uvproj1[2],xyzproj1[3];
922  ot.projete(xyz1,faceref1,uvproj1,xyzproj1);
923  double normal1[3];
924  faceref1->calcul_normale_unitaire(uvproj1,normal1);
925  double2 normal12[3];
926  normal12[0]=normal1[0];
927  normal12[1]=normal1[1];
928  normal12[2]=normal1[2];
929  OT_VECTEUR_3DD nor1(normal12);
930  int sens1=faceref1->get_mg_coface(0)->get_orientation();
931  nor1=sens1*nor1;
932  OT_TENSEUR *axe1=faceref1->get_vectorisation().get_base_locale_3d();
933  int n13=-1;
934  int signe13=1;
935  double2 limit1(0.);
936  for (int i=0;i<3;i++)
937  {
938  OT_VECTEUR_3DD veci;
939  veci[0]=(*axe1)(0,i);
940  veci[1]=(*axe1)(1,i);
941  veci[2]=(*axe1)(2,i);
942  double2 ps=veci*nor1;
943  if (f2abs(ps)>limit1)
944  {
945  n13=i;
946  if (ps<zero) signe13=-1;
947  limit1=f2abs(ps);
948  }
949  }
950  int n11,n12;
951  if (n13==0) {
952  n11=1;
953  n12=2;
954  }
955  if (n13==1) {
956  n11=0;
957  n12=2;
958  }
959  if (n13==2) {
960  n11=0;
961  n12=1;
962  }
963  OT_TENSEUR *inertie_base_locale1=faceref1->get_vectorisation().get_tenseur_inertie_base_locale_3d();
964  if ((*inertie_base_locale1)(n11,n11)<(*inertie_base_locale1)(n12,n12)) {
965  int tmp=n11;
966  n11=n12;
967  n12=tmp;
968  }
969  OT_VECTEUR_3DD x11((*axe1)(0,n11),(*axe1)(1,n11),(*axe1)(2,n11));
970  OT_VECTEUR_3DD x13((*axe1)(0,n13)*signe13,(*axe1)(1,n13)*signe13,(*axe1)(2,n13)*signe13);
971  OT_VECTEUR_3DD x12=x13 & x11;
972  (tnsref1)(0,0)=x11.get_x();
973  (tnsref1)(1,0)=x11.get_y();
974  (tnsref1)(2,0)=x11.get_z();
975  (tnsref1)(0,1)=x12.get_x();
976  (tnsref1)(1,1)=x12.get_y();
977  (tnsref1)(2,1)=x12.get_z();
978  (tnsref1)(0,2)=x13.get_x();
979  (tnsref1)(1,2)=x13.get_y();
980  (tnsref1)(2,2)=x13.get_z();
981  int nbtest1=1;
982  if ((*inertie_base_locale1)(n11,n11)==(*inertie_base_locale1)(n12,n12)) nbtest1=2; //nbtest1=2;
983  for (int test1=0;test1<nbtest1;test1++)
984  {
985  if (test1==1)
986  {
987  OT_VECTEUR_3DD x11((*axe1)(0,n12),(*axe1)(1,n12),(*axe1)(2,n12));
988  OT_VECTEUR_3DD x12=x13 & x11;
989  (tnsref1)(0,0)=x11.get_x();
990  (tnsref1)(1,0)=x11.get_y();
991  (tnsref1)(2,0)=x11.get_z();
992  (tnsref1)(0,1)=x12.get_x();
993  (tnsref1)(1,1)=x12.get_y();
994  (tnsref1)(2,1)=x12.get_z();
995  (tnsref1)(0,2)=x13.get_x();
996  (tnsref1)(1,2)=x13.get_y();
997  (tnsref1)(2,2)=x13.get_z();
998  }
999  OT_TENSEUR inv1=tnsref1.transpose();
1000  int nbpt1=faceref1->get_vectorisation().get_points_controle().size();
1001  OT_VECTEUR_3DD bary1xp,bary1yp,bary1xn,bary1yn;
1002  int xp1=0,yp1=0,xn1=0,yn1=0;
1003  for (int i=0;i<nbpt1;i++)
1004  {
1006  OT_VECTEUR_3DD point(pt[0],pt[1],pt[2]);
1007  point=point-(*bary1);
1008  point=inv1*point;
1009  if (point.get_x()>zero)
1010  {
1011  bary1xp=bary1xp+point;
1012  xp1++;
1013  }
1014  if (point.get_x()<zero)
1015  {
1016  bary1xn=bary1xn+point;
1017  xn1++;
1018  }
1019  if (point.get_y()>zero)
1020  {
1021  bary1yp=bary1yp+point;
1022  yp1++;
1023  }
1024  if (point.get_y()<zero)
1025  {
1026  bary1xn=bary1xn+point;
1027  yn1++;
1028  }
1029  }
1030  bary1xp=bary1xp/xp1;
1031  bary1xn=bary1xn/xn1;
1032  bary1yp=bary1yp/yp1;
1033  bary1yp=bary1yp/yn1;
1034  //repere2
1035  OT_VECTEUR_3DD *bary2=faceref2->get_vectorisation().get_barycentre_3d();
1036  double xyz2[3]={bary2->get_x().get_x(),bary2->get_y().get_x(),bary2->get_z().get_x()};
1037  double uvproj2[2],xyzproj2[3];
1038  ot.projete(xyz2,faceref2,uvproj2,xyzproj2);
1039  double normal2[3];
1040  faceref2->calcul_normale_unitaire(uvproj2,normal2);
1041  double2 normal22[3];
1042  normal22[0]=normal2[0];
1043  normal22[1]=normal2[1];
1044  normal22[2]=normal2[2];
1045  OT_VECTEUR_3DD nor2(normal22);
1046  int sens2=faceref2->get_mg_coface(0)->get_orientation();
1047  nor2=sens2*nor2;
1048  OT_TENSEUR *axe2=faceref2->get_vectorisation().get_base_locale_3d();
1049  int n23=-1;
1050  int signe23=1;
1051  double2 limit2(0.);
1052  for (int i=0;i<3;i++)
1053  {
1054  OT_VECTEUR_3DD veci;
1055  veci[0]=(*axe2)(0,i);
1056  veci[1]=(*axe2)(1,i);
1057  veci[2]=(*axe2)(2,i);
1058  double2 ps=veci*nor2;
1059  if (f2abs(ps)>limit2)
1060  {
1061  n23=i;
1062  if (ps<zero) signe23=-1;
1063  limit2=f2abs(ps);
1064  }
1065  }
1066  int n21,n22;
1067  if (n23==0) {
1068  n21=1;
1069  n22=2;
1070  }
1071  if (n23==1) {
1072  n21=0;
1073  n22=2;
1074  }
1075  if (n23==2) {
1076  n21=0;
1077  n22=1;
1078  }
1079  OT_TENSEUR *inertie_base_locale2=faceref2->get_vectorisation().get_tenseur_inertie_base_locale_3d();
1080  if ((*inertie_base_locale2)(n21,n21)<(*inertie_base_locale2)(n22,n22)) {
1081  int tmp=n21;
1082  n21=n22;
1083  n22=tmp;
1084  }
1085  OT_VECTEUR_3DD x21((*axe2)(0,n21),(*axe2)(1,n21),(*axe2)(2,n21));
1086  OT_VECTEUR_3DD x23((*axe2)(0,n23)*signe23,(*axe2)(1,n23)*signe23,(*axe2)(2,n23)*signe23);
1087  OT_VECTEUR_3DD x22=x23 & x21;
1088  (tnsref2)(0,0)=x21.get_x();
1089  (tnsref2)(1,0)=x21.get_y();
1090  (tnsref2)(2,0)=x21.get_z();
1091  (tnsref2)(0,1)=x22.get_x();
1092  (tnsref2)(1,1)=x22.get_y();
1093  (tnsref2)(2,1)=x22.get_z();
1094  (tnsref2)(0,2)=x23.get_x();
1095  (tnsref2)(1,2)=x23.get_y();
1096  (tnsref2)(2,2)=x23.get_z();
1097  int nbtest2=1;
1098  if ((*inertie_base_locale2)(n21,n21)==(*inertie_base_locale2)(n22,n22)) nbtest1=0; //nbtest2=2;
1099  for (int test2=0;test2<nbtest2;test2++)
1100  {
1101  if (test2==1)
1102  {
1103  OT_VECTEUR_3DD x21((*axe1)(0,n22),(*axe1)(1,n22),(*axe1)(2,n22));
1104  OT_VECTEUR_3DD x22=x23 & x21;
1105  (tnsref2)(0,0)=x21.get_x();
1106  (tnsref2)(1,0)=x21.get_y();
1107  (tnsref2)(2,0)=x21.get_z();
1108  (tnsref2)(0,1)=x22.get_x();
1109  (tnsref2)(1,1)=x22.get_y();
1110  (tnsref2)(2,1)=x22.get_z();
1111  (tnsref2)(0,2)=x23.get_x();
1112  (tnsref2)(1,2)=x23.get_y();
1113  (tnsref2)(2,2)=x23.get_z();
1114  }
1115  OT_TENSEUR inv2=tnsref2.transpose();
1116  int nbpt2=faceref2->get_vectorisation().get_points_controle().size();
1117  OT_VECTEUR_3DD bary2xp,bary2yp,bary2xn,bary2yn;
1118  int xp2=0,yp2=0,xn2=0,yn2=0;
1119  for (int i=0;i<nbpt2;i++)
1120  {
1122  OT_VECTEUR_3DD point(pt[0],pt[1],pt[2]);
1123  point=point-(*bary2);
1124  point=inv2*point;
1125  if (point.get_x()>zero)
1126  {
1127  bary2xp=bary2xp+point;
1128  xp2++;
1129  }
1130  if (point.get_x()<zero)
1131  {
1132  bary2xn=bary2xn+point;
1133  xn2++;
1134  }
1135  if (point.get_y()>zero)
1136  {
1137  bary2yp=bary2yp+point;
1138  yp2++;
1139  }
1140  if (point.get_y()<zero)
1141  {
1142  bary2xn=bary2xn+point;
1143  yn2++;
1144  }
1145  }
1146  bary2xp=bary2xp/xp2;
1147  bary2xn=bary2xn/xn2;
1148  bary2yp=bary2yp/yp2;
1149  bary2yp=bary2yp/yn2;
1150 
1151  if ((bary2xp==bary1xp) && (bary2xn==bary1xn) && (bary2yp==bary1yp) && (bary2yn==bary1yn))
1152  {
1153  list.insert(list.end(),tnsref1);
1154  list.insert(list.end(),tnsref2);
1155  }
1156  OT_VECTEUR_3DD vnul(zero,zero,zero);
1157  bary2xp=vnul;
1158  bary2xn=vnul;
1159  bary2yp=vnul;
1160  bary2yp=vnul;
1161 
1162  tnsref2(0,0)=zero-tnsref2(0,0);
1163  tnsref2(1,0)=zero-tnsref2(1,0);
1164  tnsref2(2,0)=zero-tnsref2(2,0);
1165  tnsref2(0,1)=zero-tnsref2(0,1);
1166  tnsref2(1,1)=zero-tnsref2(1,1);
1167  tnsref2(2,1)=zero-tnsref2(2,1);
1168 
1169  inv2=tnsref2.transpose();
1170  xp2=0,yp2=0,xn2=0,yn2=0;
1171  for (int i=0;i<nbpt2;i++)
1172  {
1174  OT_VECTEUR_3DD point(pt[0],pt[1],pt[2]);
1175  point=point-(*bary2);
1176  point=inv2*point;
1177  if (point.get_x()>zero)
1178  {
1179  bary2xp=bary2xp+point;
1180  xp2++;
1181  }
1182  if (point.get_x()<zero)
1183  {
1184  bary2xn=bary2xn+point;
1185  xn2++;
1186  }
1187  if (point.get_y()>zero)
1188  {
1189  bary2yp=bary2yp+point;
1190  yp2++;
1191  }
1192  if (point.get_y()<zero)
1193  {
1194  bary2xn=bary2xn+point;
1195  yn2++;
1196  }
1197  }
1198  bary2xp=bary2xp/xp2;
1199  bary2xn=bary2xn/xn2;
1200  bary2yp=bary2yp/yp2;
1201  bary2yp=bary2yp/yn2;
1202  if ((bary2xp==bary1xp) && (bary2xn==bary1xn) && (bary2yp==bary1yp) && (bary2yn==bary1yn))
1203  {
1204  list.insert(list.end(),tnsref1);
1205  list.insert(list.end(),tnsref2);
1206  }
1207  }
1208  }
1209 
1210 }
1211 
1212 
1213 
1214 
1215 
1216 
1217 
1218 
1219 
1220 
1221 
1222 
1223 
VCT_COMPARAISON::affichageactif
int affichageactif
Definition: vct_comparaison.h:76
MG_GEOMETRIE::get_valeur_precision
double get_valeur_precision(void)
Definition: mg_geometrie.cpp:2642
vct_comparaison.h
MG_ARETE::get_cosommet2
virtual class MG_COSOMMET * get_cosommet2(void)
Definition: mg_arete.cpp:85
VCT_COMPARAISON::trouve_identite
void trouve_identite(void)
Definition: vct_comparaison.cpp:259
VCT_COMPARAISON::similarite
TPL_LISTE_ENTITE< int > similarite
Definition: vct_comparaison.h:71
VCT::get_tenseur_metrique
virtual OT_TENSEUR * get_tenseur_metrique(void)
Definition: vct.cpp:204
VCT_COMPARAISON::change_point
void change_point(double *xyz)
Definition: vct_comparaison.cpp:857
VCT_COMPARAISON::mggeo1
MG_GEOMETRIE * mggeo1
Definition: vct_comparaison.h:68
VCT::get_points_controle
virtual std::vector< OT_VECTEUR_4DD > & get_points_controle(void)
Definition: vct.cpp:193
MG_BOUCLE
Definition: mg_boucle.h:35
gestionversion.h
MG_BOUCLE::get_nb_mg_coarete
virtual int get_nb_mg_coarete(void)
Definition: mg_boucle.cpp:78
MG_SURFACE
Definition: mg_surface.h:31
VCT_COMPARAISON::transformation
OT_TENSEUR transformation
Definition: vct_comparaison.h:74
MG_COURBE::inverser
virtual void inverser(double &t, double *xyz, double precision=1e-6)=0
VCT_COMPARAISON::compare
void compare(class VCT_COMPARAISON_RESULTAT &cmp, MG_VOLUME *vol1=NULL, MG_VOLUME *vol2=NULL, class OT_CPU *cpu=NULL)
Definition: vct_comparaison.cpp:59
MG_GEOMETRIE::construit_vectorisation
void construit_vectorisation(void)
Definition: mg_geometrie.cpp:2664
VCT_COMPARAISON_RESULTAT::ajouter_modifie_face
void ajouter_modifie_face(unsigned long val)
Definition: vct_comparaison_resultat.cpp:487
MG_IDENTIFICATEUR::get_id
unsigned long get_id()
Definition: mg_identificateur.cpp:53
OT_TENSEUR::transpose
virtual OT_TENSEUR transpose()
Definition: ot_tenseur.cpp:525
OT_CPU
Definition: ot_cpu.h:31
VCT_COMPARAISON_RESULTAT::ajouter_identite
void ajouter_identite(unsigned long val)
Definition: vct_comparaison_resultat.cpp:470
f2abs
double2 f2abs(double2 &val)
Definition: ot_doubleprecision.cpp:267
MG_SURFACE::evaluer
virtual void evaluer(double *uv, double *xyz)=0
VCT_COMPARAISON::identifie_correspondance
void identifie_correspondance(VCT_COMPARAISON_RESULTAT &cmp)
Definition: vct_comparaison.cpp:380
vct_outils.h
MG_GEOMETRIE_OUTILS::projete
double projete(double *xyz, MG_FACE *face, double *uvproj, double *xyzproj, double precision=1e-6)
Definition: mg_geometrie_outils.cpp:329
VCT_COMPARAISON::change_point_inverse
void change_point_inverse(double *xyz)
Definition: vct_comparaison.cpp:844
VCT_COMPARAISON::VCT_COMPARAISON
VCT_COMPARAISON(MG_GESTIONNAIRE *gst1, MG_GEOMETRIE *mgeo1, MG_GESTIONNAIRE *gst2, MG_GEOMETRIE *mgeo2)
Definition: vct_comparaison.cpp:40
MG_SURFACE::get_vectorisation
virtual VCT & get_vectorisation(void)
Definition: mg_surface.cpp:76
MG_GEOMETRIE::get_premier_face
MG_FACE * get_premier_face(LISTE_MG_FACE::iterator &it)
Definition: mg_geometrie.cpp:1338
VCT_COMPARAISON::affiche
void(* affiche)(char *mess)
Definition: vct_comparaison.h:77
double2::get_x
double get_x()
Definition: ot_doubleprecision.cpp:367
VCT_COMPARAISON::sommetparfait
int sommetparfait
Definition: vct_comparaison.h:78
VCT::get_tenseur_inertie_base_locale_3d
virtual OT_TENSEUR * get_tenseur_inertie_base_locale_3d(void)
Definition: vct.cpp:233
ot_cpu.h
OT_CPU::ajouter_etape
double ajouter_etape(std::string nom)
Definition: ot_cpu.cpp:58
OT_VECTEUR_4DD::get_w
virtual double2 get_w(void) const
Definition: ot_mathematique.cpp:1448
CORRESPONDANCE
Definition: vct_comparaison_resultat.h:40
OT_TENSEUR::identite
void identite(void)
Definition: ot_tenseur.cpp:207
MG_COFACE::get_orientation
virtual int get_orientation(void)
Definition: mg_coface.cpp:69
VCT::get_barycentre_3d
virtual OT_VECTEUR_3DD * get_barycentre_3d(void)
Definition: vct.cpp:243
MG_VOLUME
Definition: mg_volume.h:33
MG_GESTIONNAIRE
Definition: mg_gestionnaire.h:57
MG_FACE::get_nb_mg_boucle
virtual int get_nb_mg_boucle(void)
Definition: mg_face.cpp:67
MG_COURBE
Definition: mg_courbe.h:30
VCT_COMPARAISON_RESULTAT::get_face_reference1
class MG_FACE * get_face_reference1(void)
Definition: vct_comparaison_resultat.cpp:164
MG_SURFACE::get_vmax
virtual double get_vmax()
Definition: mg_surface.cpp:71
VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE
@ MODIFIE_CONSERVEE
Definition: vct_comparaison_resultat.h:63
VCT_COMPARAISON::localise_surface
int localise_surface(MG_SURFACE *surf1, MG_SURFACE *surf2)
Definition: vct_comparaison.cpp:817
VCT_COMPARAISON::recale_repere_reference
void recale_repere_reference(MG_FACE *faceref1, MG_FACE *faceref2, std::vector< OT_TENSEUR > &list)
Definition: vct_comparaison.cpp:914
VCT::get_nb_points
virtual int get_nb_points(void)
Definition: vct.cpp:186
MG_COURBE::get_tmax
virtual double get_tmax()
Definition: mg_courbe.cpp:62
MG_GEOMETRIE::get_suivant_sommet
MG_SOMMET * get_suivant_sommet(LISTE_MG_SOMMET::iterator &it)
Definition: mg_geometrie.cpp:632
VCT_COMPARAISON::transformation_inverse
OT_TENSEUR transformation_inverse
Definition: vct_comparaison.h:75
VCT_COMPARAISON::identite
TPL_LISTE_ENTITE< int > identite
Definition: vct_comparaison.h:72
vct_surface.h
VCT_COMPARAISON::trouve_similarite
void trouve_similarite(void)
Definition: vct_comparaison.cpp:222
double2
Definition: ot_doubleprecision.h:29
VCT_COMPARAISON::facepartiel
int facepartiel
Definition: vct_comparaison.h:82
OT_TENSEUR
Definition: ot_tenseur.h:41
OT_VECTEUR_4DD::get_y
virtual double2 get_y(void) const
Definition: ot_mathematique.cpp:1432
CORRESPONDANCE::PARFAITE
@ PARFAITE
Definition: vct_comparaison_resultat.h:43
MG_ARETE::get_vectorisation
virtual VCT & get_vectorisation(void)
Definition: mg_arete.cpp:245
OT_VECTEUR_3DD::get_z
virtual double2 get_z(void) const
Definition: ot_mathematique.cpp:1199
OT_VECTEUR_4DD::get_z
virtual double2 get_z(void) const
Definition: ot_mathematique.cpp:1440
VCT_COMPARAISON_RESULTAT::change_face_reference1
void change_face_reference1(class MG_FACE *face)
Definition: vct_comparaison_resultat.cpp:174
VCT_COMPARAISON_RESULTAT::get_face_reference2
class MG_FACE * get_face_reference2(void)
Definition: vct_comparaison_resultat.cpp:169
OT_VECTEUR_3DD::get_x
virtual double2 get_x(void) const
Definition: ot_mathematique.cpp:1183
OT_VECTEUR_3DD
Definition: ot_mathematique.h:350
MG_FACE::get_mg_coface
virtual MG_COFACE * get_mg_coface(int num)
Definition: mg_face.cpp:104
VCT_COMPARAISON_RESULTAT::ORIGINE_DISPARUE
@ ORIGINE_DISPARUE
Definition: vct_comparaison_resultat.h:63
CORRESPONDANCE::MODIFIE
@ MODIFIE
Definition: vct_comparaison_resultat.h:43
VCT_COMPARAISON::sommetpartiel
int sommetpartiel
Definition: vct_comparaison.h:80
VCT_COMPARAISON::trouve_localise
void trouve_localise(VCT_COMPARAISON_RESULTAT &cmp)
Definition: vct_comparaison.cpp:281
MG_FACE::get_vectorisation
virtual VCT & get_vectorisation(void)
Definition: mg_face.cpp:496
VCT_COMPARAISON::aretepartiel
int aretepartiel
Definition: vct_comparaison.h:81
constantegeo.h
VCT_COMPARAISON::~VCT_COMPARAISON
~VCT_COMPARAISON()
Definition: vct_comparaison.cpp:48
TPL_LISTE_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_liste_entite.h:38
VCT_COMPARAISON::identifie_topologie_sous_jacente
void identifie_topologie_sous_jacente(VCT_COMPARAISON_RESULTAT &cmp, MG_FACE *face1, MG_FACE *face2, int &sommetparfait, int &areteparfait)
Definition: vct_comparaison.cpp:397
OT_TENSEUR::est_til_equivalent
virtual int est_til_equivalent(OT_TENSEUR &tns)
Definition: ot_tenseur.cpp:258
MG_SURFACE::inverser
virtual void inverser(double *uv, double *xyz, double precision=1e-6)=0
VCT_COMPARAISON_RESULTAT::ajouter_liste_topologie
void ajouter_liste_topologie(int type, MG_ELEMENT_TOPOLOGIQUE *ele)
Definition: vct_comparaison_resultat.cpp:63
TPL_LISTE_ENTITE::get_nb
virtual int get_nb(void)
Definition: tpl_liste_entite.h:67
MG_SOMMET::get_point
virtual MG_POINT * get_point(void)
Definition: mg_sommet.cpp:52
VCT_COMPARAISON_RESULTAT::change_face_reference2
void change_face_reference2(class MG_FACE *face)
Definition: vct_comparaison_resultat.cpp:179
VCT_COMPARAISON::mggeo2
MG_GEOMETRIE * mggeo2
Definition: vct_comparaison.h:69
OT_VECTEUR_4DD::get_x
virtual double2 get_x(void) const
Definition: ot_mathematique.cpp:1424
MG_GEOMETRIE::get_mg_face
MG_FACE * get_mg_face(unsigned int num)
Definition: mg_geometrie.cpp:1251
MG_GEOMETRIE::get_premier_sommet
MG_SOMMET * get_premier_sommet(LISTE_MG_SOMMET::iterator &it)
Definition: mg_geometrie.cpp:624
VCT_COMPARAISON::eps
double eps
Definition: vct_comparaison.h:70
MG_COSOMMET::get_sommet
virtual MG_SOMMET * get_sommet(void)
Definition: mg_cosommet.cpp:83
TPL_LISTE_ENTITE::get
virtual X get(int num)
Definition: tpl_liste_entite.h:72
VCT_COMPARAISON_RESULTAT::ajouter_localise_arete
void ajouter_localise_arete(unsigned long val)
Definition: vct_comparaison_resultat.cpp:479
VCT_COMPARAISON::calcul_transformation
OT_TENSEUR calcul_transformation(OT_VECTEUR_3DD &bary1, OT_VECTEUR_3DD &bary2, OT_TENSEUR &tns1, OT_TENSEUR &tns2)
Definition: vct_comparaison.cpp:872
MG_COURBE::evaluer
virtual void evaluer(double t, double *xyz)=0
VCT_COMPARAISON::active_affichage
void active_affichage(void(*fonc)(char *))
Definition: vct_comparaison.cpp:52
VCT_COMPARAISON_RESULTAT::ajouter_localise_face
void ajouter_localise_face(unsigned long val)
Definition: vct_comparaison_resultat.cpp:475
MG_GEOMETRIE::get_nb_mg_face
unsigned int get_nb_mg_face(void)
Definition: mg_geometrie.cpp:1264
TPL_LISTE_ENTITE::vide
virtual void vide(void)
Definition: tpl_liste_entite.h:77
VCT_COMPARAISON_RESULTAT::get_liste_correspondance_modifie
unsigned long get_liste_correspondance_modifie(unsigned long id)
Definition: vct_comparaison_resultat.cpp:185
MG_GEOMETRIE::get_premier_arete
MG_ARETE * get_premier_arete(LISTE_MG_ARETE::iterator &it)
Definition: mg_geometrie.cpp:907
OT_VECTEUR_3D
Definition: ot_mathematique.h:94
vct_volume.h
VCT_COMPARAISON_RESULTAT::get_liste_correspondance_origine
unsigned long get_liste_correspondance_origine(unsigned long id)
Definition: vct_comparaison_resultat.cpp:193
VCT_COMPARAISON::localise_courbe
int localise_courbe(MG_COURBE *crb1, MG_COURBE *crb2)
Definition: vct_comparaison.cpp:788
MG_BOUCLE::get_mg_coarete
virtual MG_COARETE * get_mg_coarete(int num)
Definition: mg_boucle.cpp:84
MG_SURFACE::get_umax
virtual double get_umax()
Definition: mg_surface.cpp:61
VCT_COMPARAISON::trouve_modification_partielle
void trouve_modification_partielle(VCT_COMPARAISON_RESULTAT &cmp)
Definition: vct_comparaison.cpp:550
MG_FACE::calcul_normale_unitaire
virtual void calcul_normale_unitaire(double *uv, double *normale)
Definition: mg_face.cpp:248
VCT_COMPARAISON_RESULTAT::ajouter_similarite
void ajouter_similarite(unsigned long val)
Definition: vct_comparaison_resultat.cpp:465
OT_VECTEUR_3DD::get_y
virtual double2 get_y(void) const
Definition: ot_mathematique.cpp:1191
OT_TENSEUR::inverse_homogene
virtual OT_TENSEUR inverse_homogene(void)
Definition: ot_tenseur.cpp:403
VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE
@ ORIGINE_CONSERVEE
Definition: vct_comparaison_resultat.h:63
MG_COURBE::get_vectorisation
virtual VCT & get_vectorisation(void)
Definition: mg_courbe.cpp:84
MG_ARETE::get_courbe
virtual class MG_COURBE * get_courbe(void)
Definition: mg_arete.cpp:89
VCT_COMPARAISON_RESULTAT::ajouter_localise_sommet
void ajouter_localise_sommet(unsigned long val)
Definition: vct_comparaison_resultat.cpp:483
MG_GEOMETRIE::get_mg_faceid
MG_FACE * get_mg_faceid(unsigned long num)
Definition: mg_geometrie.cpp:1226
VCT_COMPARAISON_RESULTAT::MODIFIE_APPARUE
@ MODIFIE_APPARUE
Definition: vct_comparaison_resultat.h:63
MG_SURFACE::get_vmin
virtual double get_vmin()
Definition: mg_surface.cpp:66
mg_geometrie_outils.h
MG_GEOMETRIE
Definition: mg_geometrie.h:84
OT_VECTEUR_3D::get_longueur
virtual double get_longueur(void) const
Definition: ot_mathematique.cpp:483
TPL_LISTE_ENTITE< int >
VCT_COMPARAISON_RESULTAT::ajouter_modifie_arete
void ajouter_modifie_arete(unsigned long val)
Definition: vct_comparaison_resultat.cpp:491
res
#define res(i, j)
VCT::get_tenseur_inertie_base_locale_4d
virtual OT_TENSEUR * get_tenseur_inertie_base_locale_4d(void)
Definition: vct.cpp:214
VCT::get_base_locale_3d
virtual OT_TENSEUR * get_base_locale_3d(void)
Definition: vct.cpp:238
MG_ARETE
Definition: mg_arete.h:36
MG_FACE
Definition: mg_face.h:34
VCT_COMPARAISON::areteparfait
int areteparfait
Definition: vct_comparaison.h:79
MG_FACE::get_mg_boucle
virtual MG_BOUCLE * get_mg_boucle(int num)
Definition: mg_face.cpp:72
vct_face.h
MG_ARETE::get_cosommet1
virtual class MG_COSOMMET * get_cosommet1(void)
Definition: mg_arete.cpp:81
VCT_COMPARAISON_RESULTAT
Definition: vct_comparaison_resultat.h:55
MG_SOMMET
Definition: mg_sommet.h:35
MG_GEOMETRIE_OUTILS
Definition: mg_geometrie_outils.h:37
OT_VECTEUR_4DD
Definition: ot_mathematique.h:284
MG_GEOMETRIE::get_suivant_face
MG_FACE * get_suivant_face(LISTE_MG_FACE::iterator &it)
Definition: mg_geometrie.cpp:1346
MG_COARETE::get_arete
virtual MG_ARETE * get_arete(void)
Definition: mg_coarete.cpp:58
MG_SURFACE::get_umin
virtual double get_umin()
Definition: mg_surface.cpp:56
MG_GEOMETRIE::get_mg_volume
MG_VOLUME * get_mg_volume(unsigned int num)
Definition: mg_geometrie.cpp:1683
MG_POINT::evaluer
virtual void evaluer(double *xyz)=0
MG_FACE::get_surface
virtual MG_SURFACE * get_surface(void)
Definition: mg_face.cpp:109
MG_GEOMETRIE::get_suivant_arete
MG_ARETE * get_suivant_arete(LISTE_MG_ARETE::iterator &it)
Definition: mg_geometrie.cpp:915
VCT::get_tenseur_inertie_3d
virtual OT_TENSEUR * get_tenseur_inertie_3d(void)
Definition: vct.cpp:228
VCT_COMPARAISON_RESULTAT::initialise_changement_repere
void initialise_changement_repere(OT_VECTEUR_3D &vec1, OT_VECTEUR_3D &vec2, OT_VECTEUR_3D &vec3, OT_VECTEUR_3D &vec4)
Definition: vct_comparaison_resultat.cpp:54
VCT_COMPARAISON::localise
TPL_LISTE_ENTITE< int > localise
Definition: vct_comparaison.h:73
MG_COURBE::get_tmin
virtual double get_tmin()
Definition: mg_courbe.cpp:58