1 |
francois |
283 |
//--------------------------------------------------------------------------- |
2 |
|
|
#include"gestionversion.h" |
3 |
|
|
|
4 |
|
|
#pragma hdrstop |
5 |
|
|
#include <string.h> |
6 |
|
|
#include "vct_comparaison.h" |
7 |
|
|
#include "vct_volume.h" |
8 |
|
|
#include "vct_face.h" |
9 |
|
|
#include "vct_surface.h" |
10 |
|
|
#include <iomanip> |
11 |
|
|
#include "vct_outils.h" |
12 |
|
|
#include "constantegeo.h" |
13 |
|
|
#include "mg_geometrie_outils.h" |
14 |
|
|
#include "ot_cpu.h" |
15 |
|
|
|
16 |
|
|
//--------------------------------------------------------------------------- |
17 |
|
|
|
18 |
|
|
#pragma package(smart_init) |
19 |
|
|
|
20 |
|
|
|
21 |
|
|
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) |
22 |
|
|
{ |
23 |
|
|
MG_VOLUME*vol1=mggeo1->get_mg_volume(0); |
24 |
|
|
MG_VOLUME*vol2=mggeo2->get_mg_volume(0); |
25 |
|
|
eps=mggeo1->get_valeur_precision(); |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
VCT_COMPARAISON::~VCT_COMPARAISON() |
29 |
|
|
{ |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
void VCT_COMPARAISON::active_affichage(void (*fonc)(char*)) |
33 |
|
|
{ |
34 |
|
|
affiche=fonc; |
35 |
|
|
affichageactif=1; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
void VCT_COMPARAISON::compare(VCT_COMPARAISON_RESULTAT &cmp,MG_VOLUME* vol1,MG_VOLUME* vol2,OT_CPU *cpu) |
40 |
|
|
{ |
41 |
|
|
if (vol1==NULL) vol1=mggeo1->get_mg_volume(0); |
42 |
|
|
if (vol2==NULL) vol2=mggeo2->get_mg_volume(0); |
43 |
|
|
if (affichageactif==1) |
44 |
|
|
{ |
45 |
|
|
char mess[300]; |
46 |
|
|
sprintf(mess," Fichier 1 : %d faces",mggeo1->get_nb_mg_face()); |
47 |
|
|
affiche((char*)mess); |
48 |
|
|
sprintf(mess," Fichier 2 : %d faces",mggeo2->get_nb_mg_face()); |
49 |
|
|
affiche((char*)mess); |
50 |
|
|
affiche((char*)" Recherche de similarité"); |
51 |
|
|
} |
52 |
|
|
trouve_similarite(); |
53 |
|
|
if (cpu!=NULL) cpu->ajouter_etape("Similarite"); |
54 |
|
|
if (affichageactif==1) |
55 |
|
|
{ |
56 |
|
|
char mess[300]; |
57 |
|
|
sprintf(mess," Nombre de paires de faces similaires : %d",similarite.get_nb()/2); |
58 |
|
|
affiche((char*)mess); |
59 |
|
|
affiche((char*)" Recherche d'identite"); |
60 |
|
|
} |
61 |
|
|
trouve_identite(); |
62 |
|
|
if (cpu!=NULL) cpu->ajouter_etape("Identite"); |
63 |
|
|
if (affichageactif==1) |
64 |
|
|
{ |
65 |
|
|
char mess[300]; |
66 |
|
|
sprintf(mess," Nombre de paires de faces identiques : %d",identite.get_nb()/2); |
67 |
|
|
affiche((char*)mess); |
68 |
|
|
affiche((char*)" Recherche de localisation"); |
69 |
|
|
} |
70 |
|
|
trouve_localise(cmp); |
71 |
|
|
if (cpu!=NULL) cpu->ajouter_etape("Localisation"); |
72 |
|
|
if (affichageactif==1) |
73 |
|
|
{ |
74 |
|
|
char mess[300]; |
75 |
|
|
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()); |
76 |
|
|
affiche((char*)mess); |
77 |
|
|
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()); |
78 |
|
|
affiche((char*)mess); |
79 |
|
|
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()); |
80 |
|
|
affiche((char*)mess); |
81 |
|
|
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()); |
82 |
|
|
affiche((char*)mess); |
83 |
|
|
|
84 |
|
|
sprintf(mess," Nombre de paires de faces localisées : %d",localise.get_nb()/2); |
85 |
|
|
affiche((char*)mess); |
86 |
|
|
affiche((char*)" Recherche des arêtes et des sommets correspondants"); |
87 |
|
|
} |
88 |
|
|
affecter_les_couleurs(localise); |
89 |
|
|
identifie_correspondance(cmp); |
90 |
|
|
if (cpu!=NULL) cpu->ajouter_etape("Correspondance"); |
91 |
|
|
if (affichageactif==1) affiche((char*)" Recherche des modifications partielles"); |
92 |
|
|
trouve_modification_partielle(cmp); |
93 |
|
|
if (cpu!=NULL) cpu->ajouter_etape("Modifications partielles"); |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
void VCT_COMPARAISON::trouve_similarite(void) |
97 |
|
|
{ |
98 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
99 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
100 |
|
|
similarite.vide(); |
101 |
|
|
for (int i=0;i<nb_face1; i++) |
102 |
|
|
{ |
103 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
104 |
|
|
MG_SURFACE*surf1=face1->get_surface(); |
105 |
|
|
int nb_top1_pts= face1->get_vectorisation().get_nb_points(); |
106 |
|
|
int nb_geo1_pts= surf1->get_vectorisation().get_nb_points(); |
107 |
|
|
|
108 |
|
|
OT_TENSEUR *tns1_face=face1->get_vectorisation().get_tenseur_metrique(); |
109 |
|
|
OT_TENSEUR *tns1_surf=surf1->get_vectorisation().get_tenseur_metrique(); |
110 |
|
|
|
111 |
|
|
for (int j=0;j<nb_face2;j++) |
112 |
|
|
{ |
113 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
114 |
|
|
MG_SURFACE*surf2=face2->get_surface(); |
115 |
|
|
int nb_top2_pts= face2->get_vectorisation().get_nb_points(); |
116 |
|
|
int nb_geo2_pts= surf2->get_vectorisation().get_nb_points(); |
117 |
|
|
OT_TENSEUR* tns2_face=face2->get_vectorisation().get_tenseur_metrique(); |
118 |
|
|
OT_TENSEUR* tns2_surf=surf2->get_vectorisation().get_tenseur_metrique(); |
119 |
|
|
|
120 |
|
|
if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts) |
121 |
|
|
{ |
122 |
|
|
if (tns1_face->est_til_equivalent(*tns2_face)) |
123 |
|
|
{ |
124 |
|
|
if (tns1_surf->est_til_equivalent(*tns2_surf)) |
125 |
|
|
{ |
126 |
|
|
similarite.ajouter(face1->get_id()); |
127 |
|
|
similarite.ajouter(face2->get_id()); |
128 |
|
|
} |
129 |
|
|
} |
130 |
|
|
} |
131 |
|
|
} |
132 |
|
|
} |
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
void VCT_COMPARAISON::trouve_identite(void) |
136 |
|
|
{ |
137 |
|
|
identite.vide(); |
138 |
|
|
int nbpaire=similarite.get_nb()/2; |
139 |
|
|
for (int i=0;i<nbpaire;i++) |
140 |
|
|
{ |
141 |
|
|
MG_FACE* face1=mggeo1->get_mg_faceid(similarite.get(2*i)); |
142 |
|
|
MG_SURFACE*surf1=face1->get_surface(); |
143 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(similarite.get(2*i+1)); |
144 |
|
|
MG_SURFACE*surf2=face1->get_surface(); |
145 |
|
|
OT_TENSEUR *tns1_face=face1->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
146 |
|
|
OT_TENSEUR *tns1_surf=surf1->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
147 |
|
|
OT_TENSEUR *tns2_face=face2->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
148 |
|
|
OT_TENSEUR *tns2_surf=surf2->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
149 |
|
|
if (tns1_face->est_til_equivalent(*tns2_face)) |
150 |
|
|
if (tns1_surf->est_til_equivalent(*tns2_surf)) |
151 |
|
|
{ |
152 |
|
|
identite.ajouter(face1->get_id()); |
153 |
|
|
identite.ajouter(face2->get_id()); |
154 |
|
|
} |
155 |
|
|
} |
156 |
|
|
} |
157 |
|
|
void VCT_COMPARAISON::trouve_localise(VCT_COMPARAISON_RESULTAT &cmp) |
158 |
|
|
{ |
159 |
|
|
|
160 |
|
|
localise.vide(); |
161 |
|
|
TPL_LISTE_ENTITE<int> localisetmp; |
162 |
|
|
int nbpaire=identite.get_nb()/2.; |
163 |
|
|
if (nbpaire==0) |
164 |
|
|
{ |
165 |
|
|
OT_TENSEUR tmp(4,4); |
166 |
|
|
tmp.identite(); |
167 |
|
|
transformation=tmp; |
168 |
|
|
transformation_inverse=tmp; |
169 |
|
|
return; |
170 |
|
|
} |
171 |
|
|
int *paire=new int[nbpaire]; |
172 |
|
|
for (int i=0;i<nbpaire;i++) |
173 |
|
|
paire[i]=0; |
174 |
|
|
for (int ident=0;ident<nbpaire;ident++) |
175 |
|
|
{ |
176 |
|
|
if (paire[ident]==1) continue; |
177 |
|
|
MG_FACE* faceref1=mggeo1->get_mg_faceid(identite.get(2*ident)); |
178 |
|
|
MG_FACE* faceref2=mggeo2->get_mg_faceid(identite.get(2*ident+1)); |
179 |
|
|
OT_TENSEUR tnsref1(3,3); |
180 |
|
|
OT_TENSEUR tnsref2(3,3); |
181 |
|
|
std::vector<OT_TENSEUR> list; |
182 |
|
|
recale_repere_reference(faceref1,faceref2,list); |
183 |
|
|
int nbessai=list.size()/2; |
184 |
|
|
for (int essai=0;essai<nbessai;essai++) |
185 |
|
|
{ |
186 |
|
|
localisetmp.vide(); |
187 |
|
|
int *pairetmp=new int[nbpaire]; |
188 |
|
|
for (int i=0;i<nbpaire;i++) |
189 |
|
|
pairetmp[i]=0; |
190 |
|
|
OT_VECTEUR_3DD *baryref1=faceref1->get_vectorisation().get_barycentre_3d(); |
191 |
|
|
OT_VECTEUR_3DD *baryref2=faceref2->get_vectorisation().get_barycentre_3d(); |
192 |
|
|
OT_TENSEUR tnsref1=list[essai*2]; |
193 |
|
|
OT_TENSEUR tnsref2=list[essai*2+1]; |
194 |
|
|
OT_TENSEUR tnsrefinv1=tnsref1.transpose(); |
195 |
|
|
OT_TENSEUR tnsrefinv2=tnsref2.transpose(); |
196 |
|
|
for (int i=0;i<nbpaire;i++) |
197 |
|
|
{ |
198 |
|
|
MG_FACE* face1=mggeo1->get_mg_faceid(identite.get(2*i)); |
199 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(identite.get(2*i+1)); |
200 |
|
|
OT_TENSEUR *tns1=face1->get_vectorisation().get_base_locale_3d(); |
201 |
|
|
OT_TENSEUR trans1=tns1->transpose(); |
202 |
|
|
trans1=trans1*tnsref1; |
203 |
|
|
OT_TENSEUR tns2=trans1.transpose(); |
204 |
|
|
tns2=tnsref2*tns2; |
205 |
|
|
OT_TENSEUR *iner2=face2->get_vectorisation().get_tenseur_inertie_3d(); |
206 |
|
|
OT_TENSEUR *inerloc2=face2->get_vectorisation().get_tenseur_inertie_base_locale_3d(); |
207 |
|
|
OT_TENSEUR inerloc2prime=tns2.transpose(); |
208 |
|
|
inerloc2prime=inerloc2prime*(*iner2); |
209 |
|
|
inerloc2prime=inerloc2prime*tns2; |
210 |
|
|
OT_VECTEUR_3DD *bary1=face1->get_vectorisation().get_barycentre_3d(); |
211 |
|
|
OT_VECTEUR_3DD baryloc1=(*bary1)-(*baryref1); |
212 |
|
|
baryloc1=tnsrefinv1*baryloc1; |
213 |
|
|
OT_VECTEUR_3DD *bary2=face2->get_vectorisation().get_barycentre_3d(); |
214 |
|
|
OT_VECTEUR_3DD baryloc2=(*bary2)-(*baryref2); |
215 |
|
|
baryloc2=tnsrefinv2*baryloc2; |
216 |
|
|
if (inerloc2prime.est_til_equivalent(*inerloc2)) |
217 |
|
|
if (baryloc1==baryloc2) |
218 |
|
|
{ |
219 |
|
|
localisetmp.ajouter(face1->get_id()); |
220 |
|
|
localisetmp.ajouter(face2->get_id()); |
221 |
|
|
pairetmp[i]=1; |
222 |
|
|
} |
223 |
|
|
} |
224 |
|
|
if (localisetmp.get_nb()>localise.get_nb()) |
225 |
|
|
{ |
226 |
|
|
int n=localisetmp.get_nb(); |
227 |
|
|
localise.vide(); |
228 |
|
|
for (int i=0;i<n;i++) |
229 |
|
|
localise.ajouter(localisetmp.get(i)); |
230 |
|
|
for (int i=0;i<nbpaire;i++) |
231 |
|
|
paire[i]=pairetmp[i]; |
232 |
|
|
ident=0; |
233 |
|
|
transformation=calcul_transformation(*baryref1,*baryref2,tnsref1,tnsref2); |
234 |
|
|
} |
235 |
|
|
delete [] pairetmp; |
236 |
|
|
} |
237 |
|
|
} |
238 |
|
|
delete [] paire; |
239 |
|
|
transformation_inverse=transformation.inverse_homogene(); |
240 |
|
|
OT_VECTEUR_3D vec1(transformation(0,0).get_x(),transformation(1,0).get_x(),transformation(2,0).get_x()); |
241 |
|
|
OT_VECTEUR_3D vec2(transformation(0,1).get_x(),transformation(1,1).get_x(),transformation(2,1).get_x()); |
242 |
|
|
OT_VECTEUR_3D vec3(transformation(0,2).get_x(),transformation(1,2).get_x(),transformation(2,2).get_x()); |
243 |
|
|
OT_VECTEUR_3D vec4(transformation(0,3).get_x(),transformation(1,3).get_x(),transformation(2,3).get_x()); |
244 |
|
|
cmp.initialise_changement_repere(vec1,vec2,vec3,vec4); |
245 |
|
|
|
246 |
|
|
} |
247 |
|
|
void VCT_COMPARAISON::identifie_correspondance(VCT_COMPARAISON_RESULTAT &cmp) |
248 |
|
|
{ |
249 |
|
|
int sommetparfait=0,areteparfait=0; |
250 |
|
|
int nbpaire=localise.get_nb()/2.; |
251 |
|
|
for (int i=0;i<nbpaire;i++) |
252 |
|
|
{ |
253 |
|
|
MG_FACE* face1=mggeo1->get_mg_faceid(localise.get(2*i)); |
254 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(localise.get(2*i+1)); |
255 |
|
|
CORRESPONDANCE cor(face1,face2,CORRESPONDANCE::PARFAITE); |
256 |
|
|
cmp.ajouter_liste_topologie(cor); |
257 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE,face1); |
258 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE,face2); |
259 |
|
|
identifie_topologie_sous_jacente(cmp,face1,face2,sommetparfait,areteparfait); |
260 |
|
|
} |
261 |
|
|
if (affichageactif==1) |
262 |
|
|
{ |
263 |
|
|
char mess[300]; |
264 |
|
|
sprintf(mess," Nombre de paires de sommets localisés : %d",sommetparfait); |
265 |
|
|
affiche((char*)mess); |
266 |
|
|
sprintf(mess," Nombre de paires d'aretes localisées : %d",areteparfait); |
267 |
|
|
affiche((char*)mess); |
268 |
|
|
} |
269 |
|
|
} |
270 |
|
|
|
271 |
|
|
void VCT_COMPARAISON::identifie_topologie_sous_jacente(VCT_COMPARAISON_RESULTAT &cmp,MG_FACE* face1,MG_FACE* face2,int& sommetparfait,int& areteparfait) |
272 |
|
|
{ |
273 |
|
|
double2 UN(1.0); |
274 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom1; |
275 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom2; |
276 |
|
|
std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD > tabare1; |
277 |
|
|
std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD > tabare2; |
278 |
|
|
int nb_boucle=face1->get_nb_mg_boucle(); |
279 |
|
|
for (int i=0;i<nb_boucle;i++) |
280 |
|
|
{ |
281 |
|
|
MG_BOUCLE* bou1=face1->get_mg_boucle(i); |
282 |
|
|
int nb_arete=bou1->get_nb_mg_coarete(); |
283 |
|
|
for (int j=0;j<nb_arete;j++) |
284 |
|
|
{ |
285 |
|
|
MG_ARETE *are=bou1->get_mg_coarete(j)->get_arete(); |
286 |
|
|
OT_VECTEUR_3DD *bary=are->get_vectorisation().get_barycentre_3d(); |
287 |
|
|
std::pair<OT_VECTEUR_3DD,MG_ARETE*> tmp(*bary,are); |
288 |
|
|
tabare1.insert(tmp); |
289 |
|
|
MG_SOMMET *som1=are->get_cosommet1()->get_sommet(); |
290 |
|
|
double xyz[3]; |
291 |
|
|
som1->get_point()->evaluer(xyz); |
292 |
|
|
OT_VECTEUR_3DD vec(xyz[0],xyz[1],xyz[2]); |
293 |
|
|
std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp2(vec,som1); |
294 |
|
|
tabsom1.insert(tmp2); |
295 |
|
|
MG_SOMMET *som2=are->get_cosommet2()->get_sommet(); |
296 |
|
|
som2->get_point()->evaluer(xyz); |
297 |
|
|
OT_VECTEUR_3DD vec2(xyz[0],xyz[1],xyz[2]); |
298 |
|
|
std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp3(vec2,som2); |
299 |
|
|
tabsom1.insert(tmp3); |
300 |
|
|
} |
301 |
|
|
MG_BOUCLE* bou2=face2->get_mg_boucle(i); |
302 |
|
|
nb_arete=bou1->get_nb_mg_coarete(); |
303 |
|
|
for (int j=0;j<nb_arete;j++) |
304 |
|
|
{ |
305 |
|
|
MG_ARETE *are=bou2->get_mg_coarete(j)->get_arete(); |
306 |
|
|
OT_VECTEUR_3DD *bary=are->get_vectorisation().get_barycentre_3d(); |
307 |
|
|
OT_VECTEUR_4DD baryhomo(bary->get_x(),bary->get_y(),bary->get_z(),UN); |
308 |
|
|
OT_VECTEUR_4DD barytranshomo=transformation_inverse*baryhomo; |
309 |
|
|
OT_VECTEUR_3DD barytrans(barytranshomo.get_x(),barytranshomo.get_y(),barytranshomo.get_z()); |
310 |
|
|
double2 w=UN/barytranshomo.get_w(); |
311 |
|
|
barytrans=barytrans*w; |
312 |
|
|
std::pair<OT_VECTEUR_3DD,MG_ARETE*> tmp(barytrans,are); |
313 |
|
|
tabare2.insert(tmp); |
314 |
|
|
MG_SOMMET *som1=are->get_cosommet1()->get_sommet(); |
315 |
|
|
double xyz[3]; |
316 |
|
|
som1->get_point()->evaluer(xyz); |
317 |
|
|
OT_VECTEUR_4DD vechomo(xyz[0],xyz[1],xyz[2],1.); |
318 |
|
|
OT_VECTEUR_4DD vectranshomo=transformation_inverse*vechomo; |
319 |
|
|
OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z()); |
320 |
|
|
w=UN/vectranshomo.get_w(); |
321 |
|
|
vectrans=vectrans*w; |
322 |
|
|
std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp2(vectrans,som1); |
323 |
|
|
tabsom2.insert(tmp2); |
324 |
|
|
MG_SOMMET *som2=are->get_cosommet2()->get_sommet(); |
325 |
|
|
som2->get_point()->evaluer(xyz); |
326 |
|
|
OT_VECTEUR_4DD vechomo2(xyz[0],xyz[1],xyz[2],1.); |
327 |
|
|
OT_VECTEUR_4DD vectranshomo2=transformation_inverse*vechomo2; |
328 |
|
|
OT_VECTEUR_3DD vectrans2(vectranshomo2.get_x(),vectranshomo2.get_y(),vectranshomo2.get_z()); |
329 |
|
|
w=UN/vectranshomo2.get_w(); |
330 |
|
|
vectrans2=vectrans2*w; |
331 |
|
|
std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp3(vectrans2,som2); |
332 |
|
|
tabsom2.insert(tmp3); |
333 |
|
|
} |
334 |
|
|
//arete |
335 |
|
|
std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD >::iterator it1; |
336 |
|
|
std::multimap<OT_VECTEUR_3DD,MG_ARETE*,lessOT_VECTEUR_3DD >::iterator it2; |
337 |
|
|
it1=tabare1.begin(); |
338 |
|
|
int ok=0; |
339 |
|
|
if (it1==tabare1.end()) ok=1; |
340 |
|
|
while (ok==0) |
341 |
|
|
{ |
342 |
|
|
MG_ARETE* are1=(*it1).second; |
343 |
|
|
OT_VECTEUR_3DD bary1=(*it1).first; |
344 |
|
|
int nb_top1_pts= are1->get_vectorisation().get_nb_points(); |
345 |
|
|
int nb_geo1_pts= are1->get_courbe()->get_vectorisation().get_nb_points(); |
346 |
|
|
OT_TENSEUR *tns1_metrique_are=are1->get_vectorisation().get_tenseur_metrique(); |
347 |
|
|
OT_TENSEUR *tns1_metrique_crb=are1->get_courbe()->get_vectorisation().get_tenseur_metrique(); |
348 |
|
|
OT_TENSEUR *tns1_inertie_are=are1->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
349 |
|
|
OT_TENSEUR *tns1_inertie_crb=are1->get_courbe()->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
350 |
|
|
it2=tabare2.find(bary1); |
351 |
|
|
int ok2=0; |
352 |
|
|
do |
353 |
|
|
{ |
354 |
|
|
if (it2==tabare2.end()) ok2=1; |
355 |
|
|
else |
356 |
|
|
{ |
357 |
|
|
MG_ARETE* are2=(*it2).second; |
358 |
|
|
OT_VECTEUR_3DD bary2=(*it2).first; |
359 |
|
|
if (!(bary2==bary1)) ok2=1; |
360 |
|
|
else |
361 |
|
|
{ |
362 |
|
|
int nb_top2_pts= are2->get_vectorisation().get_nb_points(); |
363 |
|
|
int nb_geo2_pts= are2->get_courbe()->get_vectorisation().get_nb_points(); |
364 |
|
|
OT_TENSEUR *tns2_metrique_are=are2->get_vectorisation().get_tenseur_metrique(); |
365 |
|
|
OT_TENSEUR *tns2_metrique_crb=are2->get_courbe()->get_vectorisation().get_tenseur_metrique(); |
366 |
|
|
OT_TENSEUR *tns2_inertie_are=are2->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
367 |
|
|
OT_TENSEUR *tns2_inertie_crb=are2->get_courbe()->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
368 |
|
|
if (nb_top1_pts==nb_top2_pts) |
369 |
|
|
if (nb_geo1_pts==nb_geo2_pts) |
370 |
|
|
if (tns1_metrique_are->est_til_equivalent(*tns2_metrique_are)) |
371 |
|
|
if (tns1_metrique_crb->est_til_equivalent(*tns2_metrique_crb)) |
372 |
|
|
if (tns1_inertie_are->est_til_equivalent(*tns2_inertie_are)) |
373 |
|
|
if (tns1_inertie_crb->est_til_equivalent(*tns2_inertie_crb)) |
374 |
|
|
{ |
375 |
|
|
CORRESPONDANCE cor(are1,are2,CORRESPONDANCE::PARFAITE); |
376 |
|
|
int res=cmp.ajouter_liste_topologie(cor); |
377 |
|
|
if (res==1) |
378 |
|
|
{ |
379 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE,are1); |
380 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE,are2); |
381 |
|
|
areteparfait++; |
382 |
|
|
} |
383 |
|
|
} |
384 |
|
|
it2++; |
385 |
|
|
} |
386 |
|
|
} |
387 |
|
|
} |
388 |
|
|
while (ok2==0); |
389 |
|
|
it1++; |
390 |
|
|
if (it1==tabare1.end()) ok=1; |
391 |
|
|
} |
392 |
|
|
|
393 |
|
|
//sommet |
394 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its1; |
395 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its2; |
396 |
|
|
its1=tabsom1.begin(); |
397 |
|
|
ok=0; |
398 |
|
|
do |
399 |
|
|
{ |
400 |
|
|
MG_SOMMET* som=(*its1).second; |
401 |
|
|
its2=tabsom2.find((*its1).first); |
402 |
|
|
if (its2!=tabsom2.end()) |
403 |
|
|
{ |
404 |
|
|
CORRESPONDANCE cor((*its1).second,(*its2).second,CORRESPONDANCE::PARFAITE); |
405 |
|
|
int res=cmp.ajouter_liste_topologie(cor); |
406 |
|
|
if (res==1) |
407 |
|
|
{ |
408 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE,(*its1).second); |
409 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE,(*its2).second); |
410 |
|
|
sommetparfait++; |
411 |
|
|
} |
412 |
|
|
} |
413 |
|
|
its1++; |
414 |
|
|
if (its1==tabsom1.end()) ok=1; |
415 |
|
|
} |
416 |
|
|
while (ok==0); |
417 |
|
|
} |
418 |
|
|
} |
419 |
|
|
|
420 |
|
|
void VCT_COMPARAISON::trouve_modification_partielle(VCT_COMPARAISON_RESULTAT &cmp) |
421 |
|
|
{ |
422 |
|
|
double2 ZERO(0.); |
423 |
|
|
double2 UN(1.); |
424 |
|
|
int sommetpartiel=0,aretepartiel=0,facepartiel=0; |
425 |
|
|
//tableau des entites qui n'ont pas pu associees |
426 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom1; |
427 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD > tabsom2; |
428 |
|
|
std::multimap<int,MG_ARETE* > tabare1; |
429 |
|
|
std::multimap<int,MG_ARETE* > tabare2; |
430 |
|
|
std::multimap<int,MG_FACE* > tabface1; |
431 |
|
|
std::multimap<int,MG_FACE*> tabface2; |
432 |
|
|
|
433 |
|
|
LISTE_MG_SOMMET::iterator itsom; |
434 |
|
|
LISTE_MG_ARETE::iterator itare; |
435 |
|
|
LISTE_MG_FACE::iterator itface; |
436 |
|
|
for (MG_SOMMET* som=mggeo1->get_premier_sommet(itsom);som!=NULL;som=mggeo1->get_suivant_sommet(itsom)) |
437 |
|
|
{ |
438 |
|
|
unsigned long num=cmp.get_liste_correspondance_modifie(som->get_id()); |
439 |
|
|
if (num==0) |
440 |
|
|
{ |
441 |
|
|
double xyz[3]; |
442 |
|
|
som->get_point()->evaluer(xyz); |
443 |
|
|
OT_VECTEUR_3DD vec(xyz[0],xyz[1],xyz[2]); |
444 |
|
|
std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp(vec,som); |
445 |
|
|
tabsom1.insert(tmp); |
446 |
|
|
} |
447 |
|
|
} |
448 |
|
|
for (MG_ARETE* are=mggeo1->get_premier_arete(itare);are!=NULL;are=mggeo1->get_suivant_arete(itare)) |
449 |
|
|
{ |
450 |
|
|
unsigned long num=cmp.get_liste_correspondance_modifie(are->get_id()); |
451 |
|
|
if (num==0) |
452 |
|
|
{ |
453 |
|
|
TPL_LISTE_ENTITE<double> param; |
454 |
|
|
int typecrb=are->get_courbe()->get_type_geometrique(param); |
455 |
|
|
std::pair<int,MG_ARETE*> tmp(typecrb,are); |
456 |
|
|
tabare1.insert(tmp); |
457 |
|
|
} |
458 |
|
|
} |
459 |
|
|
for (MG_FACE* face=mggeo1->get_premier_face(itface);face!=NULL;face=mggeo1->get_suivant_face(itface)) |
460 |
|
|
{ |
461 |
|
|
unsigned long num=cmp.get_liste_correspondance_modifie(face->get_id()); |
462 |
|
|
if (num==0) |
463 |
|
|
{ |
464 |
|
|
TPL_LISTE_ENTITE<double> param; |
465 |
|
|
int typesurf=face->get_surface()->get_type_geometrique(param); |
466 |
|
|
std::pair<int,MG_FACE*> tmp(typesurf,face); |
467 |
|
|
tabface1.insert(tmp); |
468 |
|
|
} |
469 |
|
|
} |
470 |
|
|
for (MG_SOMMET* som=mggeo2->get_premier_sommet(itsom);som!=NULL;som=mggeo2->get_suivant_sommet(itsom)) |
471 |
|
|
{ |
472 |
|
|
unsigned long num=cmp.get_liste_correspondance_origine(som->get_id()); |
473 |
|
|
if (num==0) |
474 |
|
|
{ |
475 |
|
|
double xyz[3]; |
476 |
|
|
som->get_point()->evaluer(xyz); |
477 |
|
|
OT_VECTEUR_4DD vec(xyz[0],xyz[1],xyz[2],1.); |
478 |
|
|
OT_VECTEUR_4DD vectranshomo=transformation_inverse*vec; |
479 |
|
|
OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z()); |
480 |
|
|
double2 w=UN/vectranshomo.get_w(); |
481 |
|
|
vectrans=vectrans*w; |
482 |
|
|
std::pair<OT_VECTEUR_3DD,MG_SOMMET*> tmp(vectrans,som); |
483 |
|
|
tabsom2.insert(tmp); |
484 |
|
|
} |
485 |
|
|
} |
486 |
|
|
for (MG_ARETE* are=mggeo2->get_premier_arete(itare);are!=NULL;are=mggeo2->get_suivant_arete(itare)) |
487 |
|
|
{ |
488 |
|
|
unsigned long num=cmp.get_liste_correspondance_origine(are->get_id()); |
489 |
|
|
if (num==0) |
490 |
|
|
{ |
491 |
|
|
TPL_LISTE_ENTITE<double> param; |
492 |
|
|
int typecrb=are->get_courbe()->get_type_geometrique(param); |
493 |
|
|
std::pair<int,MG_ARETE*> tmp(typecrb,are); |
494 |
|
|
tabare2.insert(tmp); |
495 |
|
|
} |
496 |
|
|
} |
497 |
|
|
for (MG_FACE* face=mggeo2->get_premier_face(itface);face!=NULL;face=mggeo2->get_suivant_face(itface)) |
498 |
|
|
{ |
499 |
|
|
unsigned long num=cmp.get_liste_correspondance_origine(face->get_id()); |
500 |
|
|
if (num==0) |
501 |
|
|
{ |
502 |
|
|
TPL_LISTE_ENTITE<double> param; |
503 |
|
|
int typesurf=face->get_surface()->get_type_geometrique(param); |
504 |
|
|
std::pair<int,MG_FACE*> tmp(typesurf,face); |
505 |
|
|
tabface2.insert(tmp); |
506 |
|
|
} |
507 |
|
|
} |
508 |
|
|
//analyse sommet |
509 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its1; |
510 |
|
|
std::map<OT_VECTEUR_3DD,MG_SOMMET*,lessOT_VECTEUR_3DD >::iterator its2; |
511 |
|
|
its1=tabsom1.begin(); |
512 |
|
|
int ok=0; |
513 |
|
|
if (tabsom1.size()==0) ok=1; |
514 |
|
|
while (ok==0) |
515 |
|
|
{ |
516 |
|
|
its2=tabsom2.find((*its1).first); |
517 |
|
|
if (its2!=tabsom2.end()) |
518 |
|
|
{ |
519 |
|
|
CORRESPONDANCE cor((*its1).second,(*its2).second,CORRESPONDANCE::MODIFIE); |
520 |
|
|
cmp.ajouter_liste_topologie(cor); |
521 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE,(*its1).second); |
522 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE,(*its2).second); |
523 |
|
|
sommetpartiel++; |
524 |
|
|
} |
525 |
|
|
its1++; |
526 |
|
|
if (its1==tabsom1.end()) ok=1; |
527 |
|
|
} |
528 |
|
|
//analyse arete |
529 |
|
|
std::multimap<int,MG_ARETE* >::iterator ita1; |
530 |
|
|
std::multimap<int,MG_ARETE* >::iterator ita2; |
531 |
|
|
ita1=tabare1.begin(); |
532 |
|
|
ok=0; |
533 |
|
|
if (tabare1.size()==0) ok=1; |
534 |
|
|
while (ok==0) |
535 |
|
|
{ |
536 |
|
|
MG_ARETE* are1=(*ita1).second; |
537 |
|
|
int typecrb1=(*ita1).first; |
538 |
|
|
int nb_geo1_pts= are1->get_courbe()->get_vectorisation().get_nb_points(); |
539 |
|
|
OT_TENSEUR *tns1_metrique_crb=are1->get_courbe()->get_vectorisation().get_tenseur_metrique(); |
540 |
|
|
OT_TENSEUR *tns1_inertie_crb=are1->get_courbe()->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
541 |
|
|
ita2=tabare2.find(typecrb1); |
542 |
|
|
int ok2=0; |
543 |
|
|
do |
544 |
|
|
{ |
545 |
|
|
if (ita2==tabare2.end()) ok2=1; |
546 |
|
|
else |
547 |
|
|
{ |
548 |
|
|
MG_ARETE* are2=(*ita2).second; |
549 |
|
|
int typecrb2=(*ita2).first; |
550 |
|
|
if (!(typecrb2==typecrb1)) ok2=1; |
551 |
|
|
else |
552 |
|
|
{ |
553 |
|
|
int nb_geo2_pts= are2->get_courbe()->get_vectorisation().get_nb_points(); |
554 |
|
|
OT_TENSEUR *tns2_metrique_crb=are2->get_courbe()->get_vectorisation().get_tenseur_metrique(); |
555 |
|
|
OT_TENSEUR *tns2_inertie_crb=are2->get_courbe()->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
556 |
|
|
if (nb_geo1_pts==nb_geo2_pts) |
557 |
|
|
if (tns1_metrique_crb->est_til_equivalent(*tns2_metrique_crb)) |
558 |
|
|
if (tns1_inertie_crb->est_til_equivalent(*tns2_inertie_crb)) |
559 |
|
|
if (localise_courbe(are1->get_courbe(),are2->get_courbe())) |
560 |
|
|
{ |
561 |
|
|
CORRESPONDANCE cor(are1,are2,CORRESPONDANCE::MODIFIE); |
562 |
|
|
cmp.ajouter_liste_topologie(cor); |
563 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE,are1); |
564 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE,are2); |
565 |
|
|
aretepartiel++; |
566 |
|
|
} |
567 |
|
|
ita2++; |
568 |
|
|
} |
569 |
|
|
} |
570 |
|
|
} |
571 |
|
|
while (ok2==0); |
572 |
|
|
ita1++; |
573 |
|
|
if (ita1==tabare1.end()) ok=1; |
574 |
|
|
} |
575 |
|
|
|
576 |
|
|
//analyse face |
577 |
|
|
std::multimap<int,MG_FACE* >::iterator itf1; |
578 |
|
|
std::multimap<int,MG_FACE* >::iterator itf2; |
579 |
|
|
itf1=tabface1.begin(); |
580 |
|
|
ok=0; |
581 |
|
|
if (tabface1.size()==0) ok=1; |
582 |
|
|
while (ok==0) |
583 |
|
|
{ |
584 |
|
|
MG_FACE* face1=(*itf1).second; |
585 |
|
|
int typefac1=(*itf1).first; |
586 |
|
|
int nb_geo1_pts= face1->get_surface()->get_vectorisation().get_nb_points(); |
587 |
|
|
OT_TENSEUR *tns1_metrique_surface=face1->get_surface()->get_vectorisation().get_tenseur_metrique(); |
588 |
|
|
OT_TENSEUR *tns1_inertie_surface=face1->get_surface()->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
589 |
|
|
itf2=tabface2.find(typefac1); |
590 |
|
|
int ok2=0; |
591 |
|
|
do |
592 |
|
|
{ |
593 |
|
|
if (itf2==tabface2.end()) ok2=1; |
594 |
|
|
else |
595 |
|
|
{ |
596 |
|
|
MG_FACE* face2=(*itf2).second; |
597 |
|
|
int typefac2=(*itf2).first; |
598 |
|
|
if (typefac1!=typefac2) ok2=1; |
599 |
|
|
else |
600 |
|
|
{ |
601 |
|
|
int nb_geo2_pts= face2->get_surface()->get_vectorisation().get_nb_points(); |
602 |
|
|
OT_TENSEUR *tns2_metrique_surface=face2->get_surface()->get_vectorisation().get_tenseur_metrique(); |
603 |
|
|
OT_TENSEUR *tns2_inertie_surface=face2->get_surface()->get_vectorisation().get_tenseur_inertie_base_locale_4d(); |
604 |
|
|
if (nb_geo1_pts==nb_geo2_pts) |
605 |
|
|
//if (tns1_metrique_surface->est_til_equivalent(*tns2_metrique_surface)) |
606 |
|
|
//if (tns1_inertie_surface->est_til_equivalent(*tns2_inertie_surface)) |
607 |
|
|
if (localise_surface(face1->get_surface(),face2->get_surface())) |
608 |
|
|
{ |
609 |
|
|
CORRESPONDANCE cor(face1,face2,CORRESPONDANCE::MODIFIE); |
610 |
|
|
cmp.ajouter_liste_topologie(cor); |
611 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_CONSERVEE,face1); |
612 |
|
|
cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_CONSERVEE,face2); |
613 |
|
|
facepartiel++; |
614 |
|
|
} |
615 |
|
|
itf2++; |
616 |
|
|
} |
617 |
|
|
} |
618 |
|
|
} |
619 |
|
|
while (ok2==0); |
620 |
|
|
itf1++; |
621 |
|
|
if (itf1==tabface1.end()) ok=1; |
622 |
|
|
} |
623 |
|
|
//fin remplissage cmp |
624 |
|
|
for (its1=tabsom1.begin();its1!=tabsom1.end();its1++) |
625 |
|
|
{ |
626 |
|
|
unsigned long num=cmp.get_liste_correspondance_modifie((*its1).second->get_id()); |
627 |
|
|
if (num==0) cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_DISPARUE,(*its1).second); |
628 |
|
|
} |
629 |
|
|
for (its1=tabsom2.begin();its1!=tabsom2.end();its1++) |
630 |
|
|
{ |
631 |
|
|
unsigned long num=cmp.get_liste_correspondance_origine((*its1).second->get_id()); |
632 |
|
|
if (num==0) cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_APPARUE,(*its1).second); |
633 |
|
|
} |
634 |
|
|
for (ita1=tabare1.begin();ita1!=tabare1.end();ita1++) |
635 |
|
|
{ |
636 |
|
|
unsigned long num=cmp.get_liste_correspondance_modifie((*ita1).second->get_id()); |
637 |
|
|
if (num==0) cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_DISPARUE,(*ita1).second); |
638 |
|
|
} |
639 |
|
|
for (ita1=tabare2.begin();ita1!=tabare2.end();ita1++) |
640 |
|
|
{ |
641 |
|
|
unsigned long num=cmp.get_liste_correspondance_origine((*ita1).second->get_id()); |
642 |
|
|
if (num==0) cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_APPARUE,(*ita1).second); |
643 |
|
|
} |
644 |
|
|
for (itf1=tabface1.begin();itf1!=tabface1.end();itf1++) |
645 |
|
|
{ |
646 |
|
|
unsigned long num=cmp.get_liste_correspondance_modifie((*itf1).second->get_id()); |
647 |
|
|
if (num==0) cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::ORIGINE_DISPARUE,(*itf1).second); |
648 |
|
|
} |
649 |
|
|
for (itf1=tabface2.begin();itf1!=tabface2.end();itf1++) |
650 |
|
|
{ |
651 |
|
|
unsigned long num=cmp.get_liste_correspondance_origine((*itf1).second->get_id()); |
652 |
|
|
if (num==0) cmp.ajouter_liste_topologie(VCT_COMPARAISON_RESULTAT::MODIFIE_APPARUE,(*itf1).second); |
653 |
|
|
} |
654 |
|
|
if (affichageactif==1) |
655 |
|
|
{ |
656 |
|
|
char mess[300]; |
657 |
|
|
sprintf(mess," Nombre de paires de sommets : %d",sommetpartiel); |
658 |
|
|
affiche((char*)mess); |
659 |
|
|
sprintf(mess," Nombre de paires d'aretes : %d",aretepartiel); |
660 |
|
|
affiche((char*)mess); |
661 |
|
|
sprintf(mess," Nombre de paires de faces : %d",facepartiel); |
662 |
|
|
affiche((char*)mess); |
663 |
|
|
} |
664 |
|
|
|
665 |
|
|
} |
666 |
|
|
|
667 |
|
|
|
668 |
|
|
int VCT_COMPARAISON::localise_courbe(MG_COURBE *crb1,MG_COURBE *crb2) |
669 |
|
|
{ |
670 |
|
|
double xyz1[3],xyz2[3],xyz3[3],xyz[3]; |
671 |
|
|
double t=0.5*(crb2->get_tmax()+crb2->get_tmin()); |
672 |
|
|
double dt=(crb2->get_tmax()-crb2->get_tmin())/max(fabs(crb2->get_tmax()),fabs(crb2->get_tmin())); |
673 |
|
|
crb2->evaluer(t,xyz1); |
674 |
|
|
t=t+dt; |
675 |
|
|
crb2->evaluer(t,xyz2); |
676 |
|
|
t=t+dt; |
677 |
|
|
crb2->evaluer(t,xyz3); |
678 |
|
|
change_point_inverse(xyz1); |
679 |
|
|
change_point_inverse(xyz2); |
680 |
|
|
change_point_inverse(xyz3); |
681 |
|
|
OT_VECTEUR_3D vec(xyz1,xyz3); |
682 |
|
|
crb1->inverser(t,xyz1); |
683 |
|
|
crb1->evaluer(t,xyz); |
684 |
|
|
OT_VECTEUR_3D vec1(xyz,xyz1); |
685 |
|
|
if (vec1.get_longueur()>eps) return 0; |
686 |
|
|
crb1->inverser(t,xyz2); |
687 |
|
|
crb1->evaluer(t,xyz); |
688 |
|
|
OT_VECTEUR_3D vec2(xyz,xyz2); |
689 |
|
|
if (vec2.get_longueur()>eps) return 0; |
690 |
|
|
crb1->inverser(t,xyz3); |
691 |
|
|
crb1->evaluer(t,xyz); |
692 |
|
|
OT_VECTEUR_3D vec3(xyz,xyz3); |
693 |
|
|
if (vec3.get_longueur()>eps) return 0; |
694 |
|
|
return 1; |
695 |
|
|
} |
696 |
|
|
|
697 |
|
|
int VCT_COMPARAISON::localise_surface(MG_SURFACE *surf1,MG_SURFACE *surf2) |
698 |
|
|
{ |
699 |
|
|
double du=surf2->get_umax()-surf2->get_umin(); |
700 |
|
|
double dv=surf2->get_vmax()-surf2->get_vmin(); |
701 |
|
|
du=du/max(fabs(surf2->get_umax()),fabs(surf2->get_umin())); |
702 |
|
|
dv=dv/max(fabs(surf2->get_vmax()),fabs(surf2->get_vmin())); |
703 |
|
|
double ou=0.5*(surf2->get_umax()+surf2->get_umin()); |
704 |
|
|
double ov=0.5*(surf2->get_vmax()+surf2->get_vmin()); |
705 |
|
|
for (int i=0;i<3;i++) |
706 |
|
|
for (int j=0;j<3;j++) |
707 |
|
|
{ |
708 |
|
|
double uv[2],xyz[3]; |
709 |
|
|
uv[0]=ou+i*du; |
710 |
|
|
uv[1]=ov+j*dv; |
711 |
|
|
surf2->evaluer(uv,xyz); |
712 |
|
|
change_point_inverse(xyz); |
713 |
|
|
double xyz1[3]; |
714 |
|
|
surf1->inverser(uv,xyz); |
715 |
|
|
surf1->evaluer(uv,xyz1); |
716 |
|
|
OT_VECTEUR_3D vec(xyz,xyz1); |
717 |
|
|
if (vec.get_longueur()>eps) return 0; |
718 |
|
|
} |
719 |
|
|
return 1; |
720 |
|
|
} |
721 |
|
|
|
722 |
|
|
|
723 |
|
|
|
724 |
|
|
void VCT_COMPARAISON::change_point_inverse(double *xyz) |
725 |
|
|
{ |
726 |
|
|
double2 UN(1.); |
727 |
|
|
OT_VECTEUR_4DD vec(xyz[0],xyz[1],xyz[2],1.); |
728 |
|
|
OT_VECTEUR_4DD vectranshomo=transformation_inverse*vec; |
729 |
|
|
OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z()); |
730 |
|
|
double2 w=UN/vectranshomo.get_w(); |
731 |
|
|
vectrans=vectrans*w; |
732 |
|
|
xyz[0]=vectrans.get_x().get_x(); |
733 |
|
|
xyz[1]=vectrans.get_y().get_x(); |
734 |
|
|
xyz[2]=vectrans.get_z().get_x(); |
735 |
|
|
} |
736 |
|
|
|
737 |
|
|
void VCT_COMPARAISON::change_point(double *xyz) |
738 |
|
|
{ |
739 |
|
|
double2 UN(1.); |
740 |
|
|
OT_VECTEUR_4DD vec(xyz[0],xyz[1],xyz[2],1.); |
741 |
|
|
OT_VECTEUR_4DD vectranshomo=transformation*vec; |
742 |
|
|
OT_VECTEUR_3DD vectrans(vectranshomo.get_x(),vectranshomo.get_y(),vectranshomo.get_z()); |
743 |
|
|
double2 w=UN/vectranshomo.get_w(); |
744 |
|
|
vectrans=vectrans*w; |
745 |
|
|
xyz[0]=vectrans.get_x().get_x(); |
746 |
|
|
xyz[1]=vectrans.get_y().get_x(); |
747 |
|
|
xyz[2]=vectrans.get_z().get_x(); |
748 |
|
|
} |
749 |
|
|
|
750 |
|
|
|
751 |
|
|
|
752 |
|
|
OT_TENSEUR VCT_COMPARAISON::calcul_transformation(OT_VECTEUR_3DD &bary1,OT_VECTEUR_3DD &bary2,OT_TENSEUR &tns1,OT_TENSEUR &tns2) |
753 |
|
|
{ |
754 |
|
|
double2 zero(0.),un(1.); |
755 |
|
|
OT_TENSEUR t1(4,4); |
756 |
|
|
t1(0,0)=tns1(0,0); |
757 |
|
|
t1(1,0)=tns1(1,0); |
758 |
|
|
t1(2,0)=tns1(2,0); |
759 |
|
|
t1(3,0)=zero; |
760 |
|
|
t1(0,1)=tns1(0,1); |
761 |
|
|
t1(1,1)=tns1(1,1); |
762 |
|
|
t1(2,1)=tns1(2,1); |
763 |
|
|
t1(3,1)=zero; |
764 |
|
|
t1(0,2)=tns1(0,2); |
765 |
|
|
t1(1,2)=tns1(1,2); |
766 |
|
|
t1(2,2)=tns1(2,2); |
767 |
|
|
t1(3,2)=zero; |
768 |
|
|
t1(0,3)=bary1.get_x(); |
769 |
|
|
t1(1,3)=bary1.get_y(); |
770 |
|
|
t1(2,3)=bary1.get_z(); |
771 |
|
|
t1(3,3)=un; |
772 |
|
|
OT_TENSEUR t2(4,4); |
773 |
|
|
t2(0,0)=tns2(0,0); |
774 |
|
|
t2(1,0)=tns2(1,0); |
775 |
|
|
t2(2,0)=tns2(2,0); |
776 |
|
|
t2(3,0)=zero; |
777 |
|
|
t2(0,1)=tns2(0,1); |
778 |
|
|
t2(1,1)=tns2(1,1); |
779 |
|
|
t2(2,1)=tns2(2,1); |
780 |
|
|
t2(3,1)=zero; |
781 |
|
|
t2(0,2)=tns2(0,2); |
782 |
|
|
t2(1,2)=tns2(1,2); |
783 |
|
|
t2(2,2)=tns2(2,2); |
784 |
|
|
t2(3,2)=zero; |
785 |
|
|
t2(0,3)=bary2.get_x(); |
786 |
|
|
t2(1,3)=bary2.get_y(); |
787 |
|
|
t2(2,3)=bary2.get_z(); |
788 |
|
|
t2(3,3)=un; |
789 |
|
|
OT_TENSEUR t1inv=t1.inverse_homogene(); |
790 |
|
|
OT_TENSEUR trans=t2*t1inv; |
791 |
|
|
return trans; |
792 |
|
|
} |
793 |
|
|
|
794 |
|
|
void VCT_COMPARAISON::recale_repere_reference(MG_FACE* faceref1,MG_FACE* faceref2,vector<OT_TENSEUR> &list) |
795 |
|
|
{ |
796 |
|
|
OT_TENSEUR tnsref1(3,3),tnsref2(3,3); |
797 |
|
|
double2 zero(0.); |
798 |
|
|
// repere1 |
799 |
|
|
OT_VECTEUR_3DD *bary1=faceref1->get_vectorisation().get_barycentre_3d(); |
800 |
|
|
double xyz1[3]={bary1->get_x().get_x(),bary1->get_y().get_x(),bary1->get_z().get_x()}; |
801 |
|
|
MG_GEOMETRIE_OUTILS ot; |
802 |
|
|
double uvproj1[2],xyzproj1[3]; |
803 |
|
|
ot.projete(xyz1,faceref1,uvproj1,xyzproj1); |
804 |
|
|
double normal1[3]; |
805 |
|
|
faceref1->calcul_normale_unitaire(uvproj1,normal1); |
806 |
|
|
double2 normal12[3]; |
807 |
|
|
normal12[0]=normal1[0]; |
808 |
|
|
normal12[1]=normal1[1]; |
809 |
|
|
normal12[2]=normal1[2]; |
810 |
|
|
OT_VECTEUR_3DD nor1(normal12); |
811 |
|
|
int sens1=faceref1->get_mg_coface(0)->get_orientation(); |
812 |
|
|
nor1=sens1*nor1; |
813 |
|
|
OT_TENSEUR *axe1=faceref1->get_vectorisation().get_base_locale_3d(); |
814 |
|
|
int n13=-1; |
815 |
|
|
int signe13=1; |
816 |
|
|
double2 limit1(0.); |
817 |
|
|
for (int i=0;i<3;i++) |
818 |
|
|
{ |
819 |
|
|
OT_VECTEUR_3DD veci; |
820 |
|
|
veci[0]=(*axe1)(0,i); |
821 |
|
|
veci[1]=(*axe1)(1,i); |
822 |
|
|
veci[2]=(*axe1)(2,i); |
823 |
|
|
double2 ps=veci*nor1; |
824 |
|
|
if (f2abs(ps)>limit1) |
825 |
|
|
{ |
826 |
|
|
n13=i; |
827 |
|
|
if (ps<zero) signe13=-1; |
828 |
|
|
limit1=f2abs(ps); |
829 |
|
|
} |
830 |
|
|
} |
831 |
|
|
int n11,n12; |
832 |
|
|
if (n13==0) { |
833 |
|
|
n11=1; |
834 |
|
|
n12=2; |
835 |
|
|
} |
836 |
|
|
if (n13==1) { |
837 |
|
|
n11=0; |
838 |
|
|
n12=2; |
839 |
|
|
} |
840 |
|
|
if (n13==2) { |
841 |
|
|
n11=0; |
842 |
|
|
n12=1; |
843 |
|
|
} |
844 |
|
|
OT_TENSEUR *inertie_base_locale1=faceref1->get_vectorisation().get_tenseur_inertie_base_locale_3d(); |
845 |
|
|
if ((*inertie_base_locale1)(n11,n11)<(*inertie_base_locale1)(n12,n12)) { |
846 |
|
|
int tmp=n11; |
847 |
|
|
n11=n12; |
848 |
|
|
n12=tmp; |
849 |
|
|
} |
850 |
|
|
OT_VECTEUR_3DD x11((*axe1)(0,n11),(*axe1)(1,n11),(*axe1)(2,n11)); |
851 |
|
|
OT_VECTEUR_3DD x13((*axe1)(0,n13)*signe13,(*axe1)(1,n13)*signe13,(*axe1)(2,n13)*signe13); |
852 |
|
|
OT_VECTEUR_3DD x12=x13 & x11; |
853 |
|
|
(tnsref1)(0,0)=x11.get_x(); |
854 |
|
|
(tnsref1)(1,0)=x11.get_y(); |
855 |
|
|
(tnsref1)(2,0)=x11.get_z(); |
856 |
|
|
(tnsref1)(0,1)=x12.get_x(); |
857 |
|
|
(tnsref1)(1,1)=x12.get_y(); |
858 |
|
|
(tnsref1)(2,1)=x12.get_z(); |
859 |
|
|
(tnsref1)(0,2)=x13.get_x(); |
860 |
|
|
(tnsref1)(1,2)=x13.get_y(); |
861 |
|
|
(tnsref1)(2,2)=x13.get_z(); |
862 |
|
|
int nbtest1=1; |
863 |
|
|
if ((*inertie_base_locale1)(n11,n11)==(*inertie_base_locale1)(n12,n12)) nbtest1=0; //nbtest1=2; |
864 |
|
|
for (int test1=0;test1<nbtest1;test1++) |
865 |
|
|
{ |
866 |
|
|
if (test1==1) |
867 |
|
|
{ |
868 |
|
|
OT_VECTEUR_3DD x11((*axe1)(0,n12),(*axe1)(1,n12),(*axe1)(2,n12)); |
869 |
|
|
OT_VECTEUR_3DD x12=x13 & x11; |
870 |
|
|
(tnsref1)(0,0)=x11.get_x(); |
871 |
|
|
(tnsref1)(1,0)=x11.get_y(); |
872 |
|
|
(tnsref1)(2,0)=x11.get_z(); |
873 |
|
|
(tnsref1)(0,1)=x12.get_x(); |
874 |
|
|
(tnsref1)(1,1)=x12.get_y(); |
875 |
|
|
(tnsref1)(2,1)=x12.get_z(); |
876 |
|
|
(tnsref1)(0,2)=x13.get_x(); |
877 |
|
|
(tnsref1)(1,2)=x13.get_y(); |
878 |
|
|
(tnsref1)(2,2)=x13.get_z(); |
879 |
|
|
} |
880 |
|
|
OT_TENSEUR inv1=tnsref1.transpose(); |
881 |
|
|
int nbpt1=faceref1->get_vectorisation().get_points_controle().size(); |
882 |
|
|
OT_VECTEUR_3DD bary1xp,bary1yp,bary1xn,bary1yn; |
883 |
|
|
int xp1=0,yp1=0,xn1=0,yn1=0; |
884 |
|
|
for (int i=0;i<nbpt1;i++) |
885 |
|
|
{ |
886 |
|
|
OT_VECTEUR_4DD pt=faceref1->get_vectorisation().get_points_controle()[i]; |
887 |
|
|
OT_VECTEUR_3DD point(pt[0],pt[1],pt[2]); |
888 |
|
|
point=point-(*bary1); |
889 |
|
|
point=inv1*point; |
890 |
|
|
if (point.get_x()>zero) |
891 |
|
|
{ |
892 |
|
|
bary1xp=bary1xp+point; |
893 |
|
|
xp1++; |
894 |
|
|
} |
895 |
|
|
if (point.get_x()<zero) |
896 |
|
|
{ |
897 |
|
|
bary1xn=bary1xn+point; |
898 |
|
|
xn1++; |
899 |
|
|
} |
900 |
|
|
if (point.get_y()>zero) |
901 |
|
|
{ |
902 |
|
|
bary1yp=bary1yp+point; |
903 |
|
|
yp1++; |
904 |
|
|
} |
905 |
|
|
if (point.get_y()<zero) |
906 |
|
|
{ |
907 |
|
|
bary1xn=bary1xn+point; |
908 |
|
|
yn1++; |
909 |
|
|
} |
910 |
|
|
} |
911 |
|
|
bary1xp=bary1xp/xp1; |
912 |
|
|
bary1xn=bary1xn/xn1; |
913 |
|
|
bary1yp=bary1yp/yp1; |
914 |
|
|
bary1yp=bary1yp/yn1; |
915 |
|
|
//repere2 |
916 |
|
|
OT_VECTEUR_3DD *bary2=faceref2->get_vectorisation().get_barycentre_3d(); |
917 |
|
|
double xyz2[3]={bary2->get_x().get_x(),bary2->get_y().get_x(),bary2->get_z().get_x()}; |
918 |
|
|
double uvproj2[2],xyzproj2[3]; |
919 |
|
|
ot.projete(xyz2,faceref2,uvproj2,xyzproj2); |
920 |
|
|
double normal2[3]; |
921 |
|
|
faceref2->calcul_normale_unitaire(uvproj2,normal2); |
922 |
|
|
double2 normal22[3]; |
923 |
|
|
normal22[0]=normal2[0]; |
924 |
|
|
normal22[1]=normal2[1]; |
925 |
|
|
normal22[2]=normal2[2]; |
926 |
|
|
OT_VECTEUR_3DD nor2(normal22); |
927 |
|
|
int sens2=faceref2->get_mg_coface(0)->get_orientation(); |
928 |
|
|
nor2=sens2*nor2; |
929 |
|
|
OT_TENSEUR *axe2=faceref2->get_vectorisation().get_base_locale_3d(); |
930 |
|
|
int n23=-1; |
931 |
|
|
int signe23=1; |
932 |
|
|
double2 limit2(0.); |
933 |
|
|
for (int i=0;i<3;i++) |
934 |
|
|
{ |
935 |
|
|
OT_VECTEUR_3DD veci; |
936 |
|
|
veci[0]=(*axe2)(0,i); |
937 |
|
|
veci[1]=(*axe2)(1,i); |
938 |
|
|
veci[2]=(*axe2)(2,i); |
939 |
|
|
double2 ps=veci*nor2; |
940 |
|
|
if (f2abs(ps)>limit2) |
941 |
|
|
{ |
942 |
|
|
n23=i; |
943 |
|
|
if (ps<zero) signe23=-1; |
944 |
|
|
limit2=f2abs(ps); |
945 |
|
|
} |
946 |
|
|
} |
947 |
|
|
int n21,n22; |
948 |
|
|
if (n23==0) { |
949 |
|
|
n21=1; |
950 |
|
|
n22=2; |
951 |
|
|
} |
952 |
|
|
if (n23==1) { |
953 |
|
|
n21=0; |
954 |
|
|
n22=2; |
955 |
|
|
} |
956 |
|
|
if (n23==2) { |
957 |
|
|
n21=0; |
958 |
|
|
n22=1; |
959 |
|
|
} |
960 |
|
|
OT_TENSEUR *inertie_base_locale2=faceref2->get_vectorisation().get_tenseur_inertie_base_locale_3d(); |
961 |
|
|
if ((*inertie_base_locale2)(n21,n21)<(*inertie_base_locale2)(n22,n22)) { |
962 |
|
|
int tmp=n21; |
963 |
|
|
n21=n22; |
964 |
|
|
n22=tmp; |
965 |
|
|
} |
966 |
|
|
OT_VECTEUR_3DD x21((*axe2)(0,n21),(*axe2)(1,n21),(*axe2)(2,n21)); |
967 |
|
|
OT_VECTEUR_3DD x23((*axe2)(0,n23)*signe23,(*axe2)(1,n23)*signe23,(*axe2)(2,n23)*signe23); |
968 |
|
|
OT_VECTEUR_3DD x22=x23 & x21; |
969 |
|
|
(tnsref2)(0,0)=x21.get_x(); |
970 |
|
|
(tnsref2)(1,0)=x21.get_y(); |
971 |
|
|
(tnsref2)(2,0)=x21.get_z(); |
972 |
|
|
(tnsref2)(0,1)=x22.get_x(); |
973 |
|
|
(tnsref2)(1,1)=x22.get_y(); |
974 |
|
|
(tnsref2)(2,1)=x22.get_z(); |
975 |
|
|
(tnsref2)(0,2)=x23.get_x(); |
976 |
|
|
(tnsref2)(1,2)=x23.get_y(); |
977 |
|
|
(tnsref2)(2,2)=x23.get_z(); |
978 |
|
|
int nbtest2=1; |
979 |
|
|
if ((*inertie_base_locale2)(n21,n21)==(*inertie_base_locale2)(n22,n22)) nbtest1=0; //nbtest2=2; |
980 |
|
|
for (int test2=0;test2<nbtest2;test2++) |
981 |
|
|
{ |
982 |
|
|
if (test2==1) |
983 |
|
|
{ |
984 |
|
|
OT_VECTEUR_3DD x21((*axe1)(0,n22),(*axe1)(1,n22),(*axe1)(2,n22)); |
985 |
|
|
OT_VECTEUR_3DD x22=x23 & x21; |
986 |
|
|
(tnsref2)(0,0)=x21.get_x(); |
987 |
|
|
(tnsref2)(1,0)=x21.get_y(); |
988 |
|
|
(tnsref2)(2,0)=x21.get_z(); |
989 |
|
|
(tnsref2)(0,1)=x22.get_x(); |
990 |
|
|
(tnsref2)(1,1)=x22.get_y(); |
991 |
|
|
(tnsref2)(2,1)=x22.get_z(); |
992 |
|
|
(tnsref2)(0,2)=x23.get_x(); |
993 |
|
|
(tnsref2)(1,2)=x23.get_y(); |
994 |
|
|
(tnsref2)(2,2)=x23.get_z(); |
995 |
|
|
} |
996 |
|
|
OT_TENSEUR inv2=tnsref2.transpose(); |
997 |
|
|
int nbpt2=faceref2->get_vectorisation().get_points_controle().size(); |
998 |
|
|
OT_VECTEUR_3DD bary2xp,bary2yp,bary2xn,bary2yn; |
999 |
|
|
int xp2=0,yp2=0,xn2=0,yn2=0; |
1000 |
|
|
for (int i=0;i<nbpt2;i++) |
1001 |
|
|
{ |
1002 |
|
|
OT_VECTEUR_4DD pt=faceref2->get_vectorisation().get_points_controle()[i]; |
1003 |
|
|
OT_VECTEUR_3DD point(pt[0],pt[1],pt[2]); |
1004 |
|
|
point=point-(*bary2); |
1005 |
|
|
point=inv2*point; |
1006 |
|
|
if (point.get_x()>zero) |
1007 |
|
|
{ |
1008 |
|
|
bary2xp=bary2xp+point; |
1009 |
|
|
xp2++; |
1010 |
|
|
} |
1011 |
|
|
if (point.get_x()<zero) |
1012 |
|
|
{ |
1013 |
|
|
bary2xn=bary2xn+point; |
1014 |
|
|
xn2++; |
1015 |
|
|
} |
1016 |
|
|
if (point.get_y()>zero) |
1017 |
|
|
{ |
1018 |
|
|
bary2yp=bary2yp+point; |
1019 |
|
|
yp2++; |
1020 |
|
|
} |
1021 |
|
|
if (point.get_y()<zero) |
1022 |
|
|
{ |
1023 |
|
|
bary2xn=bary2xn+point; |
1024 |
|
|
yn2++; |
1025 |
|
|
} |
1026 |
|
|
} |
1027 |
|
|
bary2xp=bary2xp/xp2; |
1028 |
|
|
bary2xn=bary2xn/xn2; |
1029 |
|
|
bary2yp=bary2yp/yp2; |
1030 |
|
|
bary2yp=bary2yp/yn2; |
1031 |
|
|
|
1032 |
|
|
if ((bary2xp==bary1xp) && (bary2xn==bary1xn) && (bary2yp==bary1yp) && (bary2yn==bary1yn)) |
1033 |
|
|
{ |
1034 |
|
|
list.insert(list.end(),tnsref1); |
1035 |
|
|
list.insert(list.end(),tnsref2); |
1036 |
|
|
} |
1037 |
|
|
OT_VECTEUR_3DD vnul(zero,zero,zero); |
1038 |
|
|
bary2xp=vnul; |
1039 |
|
|
bary2xn=vnul; |
1040 |
|
|
bary2yp=vnul; |
1041 |
|
|
bary2yp=vnul; |
1042 |
|
|
|
1043 |
|
|
tnsref2(0,0)=zero-tnsref2(0,0); |
1044 |
|
|
tnsref2(1,0)=zero-tnsref2(1,0); |
1045 |
|
|
tnsref2(2,0)=zero-tnsref2(2,0); |
1046 |
|
|
tnsref2(0,1)=zero-tnsref2(0,1); |
1047 |
|
|
tnsref2(1,1)=zero-tnsref2(1,1); |
1048 |
|
|
tnsref2(2,1)=zero-tnsref2(2,1); |
1049 |
|
|
|
1050 |
|
|
inv2=tnsref2.transpose(); |
1051 |
|
|
xp2=0,yp2=0,xn2=0,yn2=0; |
1052 |
|
|
for (int i=0;i<nbpt2;i++) |
1053 |
|
|
{ |
1054 |
|
|
OT_VECTEUR_4DD pt=faceref2->get_vectorisation().get_points_controle()[i]; |
1055 |
|
|
OT_VECTEUR_3DD point(pt[0],pt[1],pt[2]); |
1056 |
|
|
point=point-(*bary2); |
1057 |
|
|
point=inv2*point; |
1058 |
|
|
if (point.get_x()>zero) |
1059 |
|
|
{ |
1060 |
|
|
bary2xp=bary2xp+point; |
1061 |
|
|
xp2++; |
1062 |
|
|
} |
1063 |
|
|
if (point.get_x()<zero) |
1064 |
|
|
{ |
1065 |
|
|
bary2xn=bary2xn+point; |
1066 |
|
|
xn2++; |
1067 |
|
|
} |
1068 |
|
|
if (point.get_y()>zero) |
1069 |
|
|
{ |
1070 |
|
|
bary2yp=bary2yp+point; |
1071 |
|
|
yp2++; |
1072 |
|
|
} |
1073 |
|
|
if (point.get_y()<zero) |
1074 |
|
|
{ |
1075 |
|
|
bary2xn=bary2xn+point; |
1076 |
|
|
yn2++; |
1077 |
|
|
} |
1078 |
|
|
} |
1079 |
|
|
bary2xp=bary2xp/xp2; |
1080 |
|
|
bary2xn=bary2xn/xn2; |
1081 |
|
|
bary2yp=bary2yp/yp2; |
1082 |
|
|
bary2yp=bary2yp/yn2; |
1083 |
|
|
if ((bary2xp==bary1xp) && (bary2xn==bary1xn) && (bary2yp==bary1yp) && (bary2yn==bary1yn)) |
1084 |
|
|
{ |
1085 |
|
|
list.insert(list.end(),tnsref1); |
1086 |
|
|
list.insert(list.end(),tnsref2); |
1087 |
|
|
} |
1088 |
|
|
} |
1089 |
|
|
} |
1090 |
|
|
|
1091 |
|
|
} |
1092 |
|
|
|
1093 |
|
|
|
1094 |
|
|
void VCT_COMPARAISON::choisir_une_couleur(double& val) |
1095 |
|
|
{ |
1096 |
|
|
unsigned char r=rand() % 255; |
1097 |
|
|
unsigned char g=rand() % 255; |
1098 |
|
|
unsigned char b=rand() % 255; |
1099 |
|
|
val=0.; |
1100 |
|
|
unsigned char* p =(unsigned char*)&val; |
1101 |
|
|
*p=r; |
1102 |
|
|
p++; |
1103 |
|
|
*p=g; |
1104 |
|
|
p++; |
1105 |
|
|
*p=b; |
1106 |
|
|
|
1107 |
|
|
} |
1108 |
|
|
|
1109 |
|
|
|
1110 |
|
|
double VCT_COMPARAISON::recherche_couleur(MG_ELEMENT_TOPOLOGIQUE* ele) |
1111 |
|
|
{ |
1112 |
|
|
double val=-1; |
1113 |
|
|
int nbccf=ele->get_nb_ccf(); |
1114 |
|
|
for (int i=0;i<nbccf;i++) |
1115 |
|
|
{ |
1116 |
|
|
char nom[10]; |
1117 |
|
|
ele->get_type_ccf(i,nom); |
1118 |
|
|
if (strcmp(nom,"Cc")==0) val=ele->get_valeur_ccf(i); |
1119 |
|
|
} |
1120 |
|
|
return val; |
1121 |
|
|
} |
1122 |
|
|
|
1123 |
|
|
void VCT_COMPARAISON::supprime_couleur(MG_ELEMENT_TOPOLOGIQUE* ele) |
1124 |
|
|
{ |
1125 |
|
|
int nbccf=ele->get_nb_ccf(); |
1126 |
|
|
for (int i=0;i<nbccf;i++) |
1127 |
|
|
{ |
1128 |
|
|
char nom[10]; |
1129 |
|
|
ele->get_type_ccf(i,nom); |
1130 |
|
|
if (strcmp(nom,"Cc")==0) { |
1131 |
|
|
ele->supprimer_ccf(i); |
1132 |
|
|
nbccf--; |
1133 |
|
|
i--; |
1134 |
|
|
} |
1135 |
|
|
} |
1136 |
|
|
} |
1137 |
|
|
|
1138 |
|
|
void VCT_COMPARAISON::affecter_les_couleurs(TPL_LISTE_ENTITE<int>& liste) |
1139 |
|
|
{ |
1140 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
1141 |
|
|
for (int i=0;i<nb_face1;i++) |
1142 |
|
|
supprime_couleur(mggeo1->get_mg_face(i)); |
1143 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
1144 |
|
|
for (int i=0;i<nb_face2;i++) |
1145 |
|
|
supprime_couleur(mggeo2->get_mg_face(i)); |
1146 |
|
|
TPL_LISTE_ENTITE<double> lst_val; |
1147 |
|
|
int nbpaire=liste.get_nb()/2; |
1148 |
|
|
for (int i=0;i<nbpaire;i++) |
1149 |
|
|
{ |
1150 |
|
|
MG_FACE* ele1=mggeo1->get_mg_faceid(liste.get(2*i)); |
1151 |
|
|
MG_FACE* ele2=mggeo2->get_mg_faceid(liste.get(2*i+1)); |
1152 |
|
|
double val1=recherche_couleur(ele1); |
1153 |
|
|
double val2=recherche_couleur(ele2); |
1154 |
|
|
double val; |
1155 |
|
|
if (val1<0.) |
1156 |
|
|
{ |
1157 |
|
|
if (val2<0.) |
1158 |
|
|
{ |
1159 |
|
|
do |
1160 |
|
|
{ |
1161 |
|
|
choisir_une_couleur(val); |
1162 |
|
|
} |
1163 |
|
|
while (lst_val.est_dans_la_liste(val)); |
1164 |
|
|
lst_val.ajouter(val); |
1165 |
|
|
} |
1166 |
|
|
else val=val2; |
1167 |
|
|
} |
1168 |
|
|
else val=val1; |
1169 |
|
|
if (val1<0.) ele1->ajouter_ccf((char*)"Cc",val); |
1170 |
|
|
if (val2<0.) ele2->ajouter_ccf((char*)"Cc",val); |
1171 |
|
|
} |
1172 |
|
|
} |
1173 |
|
|
|
1174 |
|
|
|
1175 |
|
|
|
1176 |
|
|
|
1177 |
|
|
|
1178 |
|
|
|
1179 |
|
|
|
1180 |
|
|
|
1181 |
|
|
|
1182 |
|
|
|
1183 |
|
|
|
1184 |
|
|
|
1185 |
|
|
|
1186 |
|
|
|
1187 |
|
|
#ifdef TA_GUEULE |
1188 |
|
|
void VCT_COMPARAISON::compare_les_deux_geometries(int affiche_couleur) |
1189 |
|
|
{ |
1190 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
1191 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
1192 |
|
|
|
1193 |
|
|
for (int i=0;i<nb_face1; i++) |
1194 |
|
|
{ |
1195 |
|
|
OT_VECTEUR_4DD Dv1,Dv2,G1,G2; |
1196 |
|
|
OT_TENSEUR V1(4),V2(4); |
1197 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
1198 |
|
|
MG_SURFACE*surf1=face1->get_surface(); |
1199 |
|
|
G1=surf1->get_vectorisation().calcule_barycentre(T1); |
1200 |
|
|
G1=surf1->get_vectorisation().get_nouveau_pt(T1,G1); |
1201 |
|
|
int id1=face1->get_id(); |
1202 |
|
|
OT_TENSEUR tns1_face(4),tns1_surf(4); |
1203 |
|
|
OT_TENSEUR ttns1_face(4),ttns1_surf(4); |
1204 |
|
|
int nb_top1_pts= face1->get_vectorisation().get_nb_points(); |
1205 |
|
|
int nb_geo1_pts= surf1->get_vectorisation().get_nb_points(); |
1206 |
|
|
|
1207 |
|
|
face1->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
1208 |
|
|
tns1_face=face1->get_vectorisation().calcule_tenseur_metrique(); |
1209 |
|
|
tns1_surf=surf1->get_vectorisation().calcule_tenseur_metrique(); |
1210 |
|
|
|
1211 |
|
|
ttns1_face=face1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1212 |
|
|
ttns1_surf=surf1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1213 |
|
|
vector<double2> ifac1; |
1214 |
|
|
vector<double2>isurf1; |
1215 |
|
|
for (int r=0;r<4;r++) |
1216 |
|
|
{ |
1217 |
|
|
ifac1.insert( ifac1.end(), ttns1_face(r,r)); |
1218 |
|
|
isurf1.insert( isurf1.end(), ttns1_surf(r,r)); |
1219 |
|
|
} |
1220 |
|
|
int cmpt=0; |
1221 |
|
|
for (int j=0;j<nb_face2;j++) |
1222 |
|
|
{ |
1223 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
1224 |
|
|
MG_SURFACE*surf2=face2->get_surface(); |
1225 |
|
|
G2=surf2->get_vectorisation().calcule_barycentre(T2); |
1226 |
|
|
int id2=face2->get_id(); |
1227 |
|
|
OT_TENSEUR tns2_face(4),tns2_surf(4); |
1228 |
|
|
OT_TENSEUR ttns2_face(4),ttns2_surf(4); |
1229 |
|
|
int nb_top2_pts= face2->get_vectorisation().get_nb_points(); |
1230 |
|
|
int nb_geo2_pts= surf2->get_vectorisation().get_nb_points(); |
1231 |
|
|
|
1232 |
|
|
face2->get_vectorisation().calcule_axes_dinertie(T2,Dv1,V1); |
1233 |
|
|
tns2_face=face2->get_vectorisation().calcule_tenseur_metrique(); |
1234 |
|
|
tns2_surf=surf2->get_vectorisation().calcule_tenseur_metrique(); |
1235 |
|
|
|
1236 |
|
|
ttns2_face=face2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
1237 |
|
|
ttns2_surf=surf2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
1238 |
|
|
vector<double2> ifac2; |
1239 |
|
|
vector<double2> isurf2; |
1240 |
|
|
for (int r=0;r<4;r++) |
1241 |
|
|
{ |
1242 |
|
|
ifac2.insert( ifac2.end(), ttns2_face(r,r)); |
1243 |
|
|
isurf2.insert( isurf2.end(), ttns2_surf(r,r)); |
1244 |
|
|
} |
1245 |
|
|
|
1246 |
|
|
if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts) |
1247 |
|
|
{ |
1248 |
|
|
if (tns1_face.est_til_equivalent(tns2_face)) |
1249 |
|
|
{ |
1250 |
|
|
verifier_le_repere(V1,V2,ifac1,ifac2); |
1251 |
|
|
if (tns1_surf.est_til_equivalent(tns2_surf)) |
1252 |
|
|
{ |
1253 |
|
|
similarite.ajouter(id1); |
1254 |
|
|
similarite.ajouter(id2); |
1255 |
|
|
vector<unsigned int> indx1,indx2; |
1256 |
|
|
if (ttns1_face.listes_equivalentes(isurf1,isurf2,indx2)) |
1257 |
|
|
{ |
1258 |
|
|
if (G1==G2) |
1259 |
|
|
{ |
1260 |
|
|
surf_ident.ajouter(id1); |
1261 |
|
|
surf_ident.ajouter(id2); |
1262 |
|
|
} |
1263 |
|
|
|
1264 |
|
|
if (ttns1_face.listes_equivalentes(ifac1,ifac2,indx1)) |
1265 |
|
|
{ |
1266 |
|
|
sim_double.ajouter(id1) ; |
1267 |
|
|
sim_double.ajouter(id2) ; |
1268 |
|
|
cmpt++; |
1269 |
|
|
} |
1270 |
|
|
} |
1271 |
|
|
|
1272 |
|
|
} |
1273 |
|
|
} |
1274 |
|
|
} |
1275 |
|
|
} |
1276 |
|
|
|
1277 |
|
|
nb_sim.ajouter(cmpt); |
1278 |
|
|
} |
1279 |
|
|
|
1280 |
|
|
if (sim_double.get_nb()==0) |
1281 |
|
|
{ |
1282 |
|
|
sim_double=surf_ident; |
1283 |
|
|
} |
1284 |
|
|
if (affiche_couleur) this->affecter_les_couleurs(23); |
1285 |
|
|
} |
1286 |
|
|
|
1287 |
|
|
|
1288 |
|
|
|
1289 |
|
|
void VCT_COMPARAISON::trouver_les_identites(int affiche_couleur) |
1290 |
|
|
{ |
1291 |
|
|
|
1292 |
|
|
TPL_LISTE_ENTITE<int> lst_fin; |
1293 |
|
|
TPL_LISTE_ENTITE<int> lst; |
1294 |
|
|
this->compare_les_deux_geometries(0); |
1295 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
1296 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
1297 |
|
|
|
1298 |
|
|
|
1299 |
|
|
|
1300 |
|
|
|
1301 |
|
|
this->trouve_face_de_reference(face_ref1,face_ref2);//,ls,lst_fin |
1302 |
|
|
|
1303 |
|
|
OT_VECTEUR_4DD Dv,Dv1,Dv2,G1ref,G2ref,g1g2; |
1304 |
|
|
OT_TENSEUR V(4),V1(4),V2(4); |
1305 |
|
|
OT_VECTEUR_4DD g1_ref,g2_ref; |
1306 |
|
|
MG_FACE* face1_ref=mggeo1->get_mg_faceid(face_ref1); |
1307 |
|
|
//MG_SURFACE* surf1_ref=face1_ref->get_surface(); |
1308 |
|
|
//G1ref= surf1_ref->get_vectorisation().calcule_barycentre(T1); |
1309 |
|
|
G1ref= face1_ref->get_vectorisation().calcule_barycentre(T1); |
1310 |
|
|
G1ref= face1_ref->get_vectorisation().get_nouveau_pt(T1,G1ref); |
1311 |
|
|
//face1_ref->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
1312 |
|
|
/* |
1313 |
|
|
for(int r=0;r<4;r++) { |
1314 |
|
|
for(int s=0;s<4;s++) { |
1315 |
|
|
g1_ref[r]= g1_ref[r]+V1(s,r)*G1[s]; |
1316 |
|
|
} |
1317 |
|
|
} |
1318 |
|
|
*/ |
1319 |
|
|
|
1320 |
|
|
MG_FACE* face2_ref=mggeo2->get_mg_faceid(face_ref2); |
1321 |
|
|
//face2_ref->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
1322 |
|
|
//MG_SURFACE* surf2_ref=face2_ref->get_surface(); |
1323 |
|
|
//G2ref= surf2_ref->get_vectorisation().calcule_barycentre(T2); |
1324 |
|
|
G2ref= face2_ref->get_vectorisation().calcule_barycentre(T2); |
1325 |
|
|
/* |
1326 |
|
|
for(int r=0;r<4;r++) { |
1327 |
|
|
for(int s=0;s<4;s++) { |
1328 |
|
|
g2_ref[r]= g2_ref[r]+V2(s,r)*G2[s]; |
1329 |
|
|
} |
1330 |
|
|
} |
1331 |
|
|
*/ |
1332 |
|
|
|
1333 |
|
|
OT_VECTEUR_4DD g1refg1,g2refg2; |
1334 |
|
|
|
1335 |
|
|
|
1336 |
|
|
|
1337 |
|
|
for (int i=0;i<nb_face1;i++) |
1338 |
|
|
{ |
1339 |
|
|
|
1340 |
|
|
OT_VECTEUR_4DD g1,G1; |
1341 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
1342 |
|
|
int id1=face1->get_id(); |
1343 |
|
|
G1= face1->get_vectorisation().calcule_barycentre(T1); |
1344 |
|
|
G1= face1->get_vectorisation().get_nouveau_pt(T1,G1); |
1345 |
|
|
/* |
1346 |
|
|
for(int r=0;r<4;r++) { |
1347 |
|
|
for(int s=0;s<4;s++) { |
1348 |
|
|
g1[r]= g1[r]+V1(s,r)*G1[s]; |
1349 |
|
|
} |
1350 |
|
|
} |
1351 |
|
|
*/ |
1352 |
|
|
g1refg1=G1-G1ref; |
1353 |
|
|
g1refg1=face1->get_vectorisation().get_nouveau_pt(T1,g1refg1); |
1354 |
|
|
//g1refg1=g1-g1_ref; |
1355 |
|
|
// num2=list.get(2*i+1); |
1356 |
|
|
for (int j=0;j<nb_face2;j++) |
1357 |
|
|
{ |
1358 |
|
|
|
1359 |
|
|
OT_VECTEUR_4DD g2,G2,g12refg2; |
1360 |
|
|
|
1361 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
1362 |
|
|
int id2=face2->get_id(); |
1363 |
|
|
G2= face2->get_vectorisation().calcule_barycentre(T2); |
1364 |
|
|
|
1365 |
|
|
/* for(int r=0;r<4;r++) { |
1366 |
|
|
for(int s=0;s<4;s++) { |
1367 |
|
|
g2[r]= g2[r]+V2(s,r)*G2[s]; |
1368 |
|
|
} |
1369 |
|
|
} |
1370 |
|
|
*/ |
1371 |
|
|
//OT_VECTEUR_4DD g2refg2=g2-g2_ref; |
1372 |
|
|
// g12refg2=G2-G2ref; |
1373 |
|
|
OT_VECTEUR_4DD g2refg2=G2-G2ref; |
1374 |
|
|
//OT_VECTEUR_4DD dif= g1refg1-g2refg2; |
1375 |
|
|
//double2 prec=1e-6; |
1376 |
|
|
// if(dif[0].get_fabs()<=prec&&dif[1].get_fabs()<=prec&&dif[2].get_fabs()<=prec&&dif[3].get_fabs()<=prec) |
1377 |
|
|
if (g2refg2==g1refg1) |
1378 |
|
|
{ |
1379 |
|
|
identite.ajouter(id1); |
1380 |
|
|
identite.ajouter(id2); |
1381 |
|
|
|
1382 |
|
|
break; |
1383 |
|
|
} |
1384 |
|
|
} |
1385 |
|
|
} |
1386 |
|
|
|
1387 |
|
|
|
1388 |
|
|
|
1389 |
|
|
|
1390 |
|
|
if (affiche_couleur) this->affecter_les_couleurs(1); |
1391 |
|
|
|
1392 |
|
|
} |
1393 |
|
|
|
1394 |
|
|
|
1395 |
|
|
|
1396 |
|
|
void VCT_COMPARAISON::compare_les_deux_geometries_vectoriellement(int affiche_couleur) |
1397 |
|
|
{ |
1398 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
1399 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
1400 |
|
|
similarite.vide(); |
1401 |
|
|
for (int i=0;i<nb_face1; i++) |
1402 |
|
|
{ |
1403 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
1404 |
|
|
MG_SURFACE*surf1=face1->get_surface(); |
1405 |
|
|
int id1=face1->get_id(); |
1406 |
|
|
OT_TENSEUR tns1_face(4),tns1_surf(4); |
1407 |
|
|
OT_TENSEUR ttns1_face(4),ttns1_surf(4); |
1408 |
|
|
int nb_top1_pts= face1->get_vectorisation().get_nb_points(); |
1409 |
|
|
int nb_geo1_pts= surf1->get_vectorisation().get_nb_points(); |
1410 |
|
|
|
1411 |
|
|
tns1_face=face1->get_vectorisation().calcule_tenseur_metrique(); |
1412 |
|
|
tns1_surf=surf1->get_vectorisation().calcule_tenseur_metrique(); |
1413 |
|
|
|
1414 |
|
|
for (int j=0;j<nb_face2;j++) |
1415 |
|
|
{ |
1416 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
1417 |
|
|
MG_SURFACE*surf2=face2->get_surface(); |
1418 |
|
|
int id2=face2->get_id(); |
1419 |
|
|
OT_TENSEUR tns2_face(4),tns2_surf(4); |
1420 |
|
|
OT_TENSEUR ttns2_face(4),ttns2_surf(4); |
1421 |
|
|
int nb_top2_pts= face2->get_vectorisation().get_nb_points(); |
1422 |
|
|
int nb_geo2_pts= surf2->get_vectorisation().get_nb_points(); |
1423 |
|
|
tns2_face=face2->get_vectorisation().calcule_tenseur_metrique(); |
1424 |
|
|
tns2_surf=surf2->get_vectorisation().calcule_tenseur_metrique(); |
1425 |
|
|
|
1426 |
|
|
if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts) |
1427 |
|
|
{ |
1428 |
|
|
if (tns1_face.est_til_equivalent(tns2_face)) |
1429 |
|
|
{ |
1430 |
|
|
if (tns1_surf.est_til_equivalent(tns2_surf)) |
1431 |
|
|
{ |
1432 |
|
|
similarite.ajouter(id1); |
1433 |
|
|
similarite.ajouter(id2); |
1434 |
|
|
} |
1435 |
|
|
} |
1436 |
|
|
} |
1437 |
|
|
} |
1438 |
|
|
} |
1439 |
|
|
if (affiche_couleur)this->affecter_les_couleurs(21); |
1440 |
|
|
|
1441 |
|
|
} |
1442 |
|
|
|
1443 |
|
|
void VCT_COMPARAISON::compare_les_deux_geometries_inertiellement (int affiche_couleur) |
1444 |
|
|
{ |
1445 |
|
|
|
1446 |
|
|
|
1447 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
1448 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
1449 |
|
|
ssimilarite.vide(); |
1450 |
|
|
for (int i=0;i<nb_face1; i++) |
1451 |
|
|
{ |
1452 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
1453 |
|
|
MG_SURFACE*surf1=face1->get_surface(); |
1454 |
|
|
int id1=face1->get_id(); |
1455 |
|
|
OT_TENSEUR tns1_face(4),tns1_surf(4); |
1456 |
|
|
int nb_top1_pts= face1->get_vectorisation().get_nb_points(); |
1457 |
|
|
int nb_geo1_pts= surf1->get_vectorisation().get_nb_points(); |
1458 |
|
|
|
1459 |
|
|
tns1_face=face1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1460 |
|
|
tns1_surf=surf1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1461 |
|
|
vector<double2> ifac1; |
1462 |
|
|
vector<double2>isurf1; |
1463 |
|
|
for (int r=0;r<4;r++) |
1464 |
|
|
{ |
1465 |
|
|
ifac1.insert( ifac1.end(), tns1_face(r,r)); |
1466 |
|
|
isurf1.insert( isurf1.end(), tns1_surf(r,r)); |
1467 |
|
|
} |
1468 |
|
|
|
1469 |
|
|
for (int j=0;j<nb_face2;j++) |
1470 |
|
|
{ |
1471 |
|
|
|
1472 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
1473 |
|
|
MG_SURFACE*surf2=face2->get_surface(); |
1474 |
|
|
int id2=face2->get_id(); |
1475 |
|
|
OT_TENSEUR tns2_face(4),tns2_surf(4); |
1476 |
|
|
int nb_top2_pts= face2->get_vectorisation().get_nb_points(); |
1477 |
|
|
int nb_geo2_pts= surf2->get_vectorisation().get_nb_points(); |
1478 |
|
|
*tns2_face=face2->get_vectorisation().get_tenseur_inertie_base_locale(); |
1479 |
|
|
*tns2_surf=surf2->get_vectorisation().get_tenseur_inertie_base_locale(); |
1480 |
|
|
vector<double2> ifac2; |
1481 |
|
|
vector<double2> isurf2; |
1482 |
|
|
for (int r=0;r<4;r++) |
1483 |
|
|
{ |
1484 |
|
|
ifac2.insert( ifac2.end(), *tns2_face(r,r)); |
1485 |
|
|
isurf2.insert( isurf2.end(), *tns2_surf(r,r)); |
1486 |
|
|
} |
1487 |
|
|
|
1488 |
|
|
if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts) |
1489 |
|
|
{ |
1490 |
|
|
vector<unsigned int> indx1,indx2; |
1491 |
|
|
if (tns1_face.listes_equivalentes(ifac1,ifac2,indx1)) |
1492 |
|
|
{ |
1493 |
|
|
if (tns1_face.listes_equivalentes(isurf1,isurf2,indx2)) |
1494 |
|
|
{ |
1495 |
|
|
ssimilarite.ajouter(id1); |
1496 |
|
|
ssimilarite.ajouter(id2); |
1497 |
|
|
} |
1498 |
|
|
} |
1499 |
|
|
} |
1500 |
|
|
|
1501 |
|
|
} |
1502 |
|
|
|
1503 |
|
|
} |
1504 |
|
|
|
1505 |
|
|
if (affiche_couleur)affecter_les_couleurs(22); |
1506 |
|
|
} |
1507 |
|
|
|
1508 |
|
|
void VCT_COMPARAISON::compare_une_geometrie_inertiellement(int modele) |
1509 |
|
|
{ |
1510 |
|
|
|
1511 |
|
|
|
1512 |
|
|
TPL_LISTE_ENTITE<int> ssim_tmp; |
1513 |
|
|
|
1514 |
|
|
MG_GESTIONNAIRE *gst1; |
1515 |
|
|
MG_GEOMETRIE *mgeo1 ; |
1516 |
|
|
int laquelle; |
1517 |
|
|
|
1518 |
|
|
switch (modele) |
1519 |
|
|
{ |
1520 |
|
|
case 1: |
1521 |
|
|
{ |
1522 |
|
|
gst1=gest1; |
1523 |
|
|
mgeo1=mggeo1; |
1524 |
|
|
laquelle=31; |
1525 |
|
|
break; |
1526 |
|
|
} |
1527 |
|
|
case 2: |
1528 |
|
|
{ |
1529 |
|
|
gst1=gest2; |
1530 |
|
|
mgeo1=mggeo2; |
1531 |
|
|
laquelle=32; |
1532 |
|
|
break; |
1533 |
|
|
} |
1534 |
|
|
|
1535 |
|
|
} |
1536 |
|
|
|
1537 |
|
|
int nb_face1=mgeo1->get_nb_mg_face(); |
1538 |
|
|
|
1539 |
|
|
for (int i=0;i<nb_face1; i++) |
1540 |
|
|
{ |
1541 |
|
|
MG_FACE* face1=mgeo1->get_mg_face(i); |
1542 |
|
|
MG_SURFACE*surf1=face1->get_surface(); |
1543 |
|
|
int id1=face1->get_id(); |
1544 |
|
|
OT_TENSEUR tns1_face(4),tns1_surf(4); |
1545 |
|
|
int nb_top1_pts= face1->get_vectorisation().get_nb_points(); |
1546 |
|
|
int nb_geo1_pts= surf1->get_vectorisation().get_nb_points(); |
1547 |
|
|
|
1548 |
|
|
tns1_face=face1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1549 |
|
|
tns1_surf=surf1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1550 |
|
|
vector<double2> ifac1; |
1551 |
|
|
vector<double2>isurf1; |
1552 |
|
|
for (int r=0;r<4;r++) |
1553 |
|
|
{ |
1554 |
|
|
ifac1.insert( ifac1.end(), tns1_face(r,r)); |
1555 |
|
|
isurf1.insert( isurf1.end(), tns1_surf(r,r)); |
1556 |
|
|
} |
1557 |
|
|
|
1558 |
|
|
for (int j=0;j<nb_face1;j++) |
1559 |
|
|
{ |
1560 |
|
|
|
1561 |
|
|
MG_FACE* face2=mgeo1->get_mg_face(j); |
1562 |
|
|
MG_SURFACE*surf2=face2->get_surface(); |
1563 |
|
|
int id2=face2->get_id(); |
1564 |
|
|
OT_TENSEUR tns2_face(4),tns2_surf(4); |
1565 |
|
|
int nb_top2_pts= face2->get_vectorisation().get_nb_points(); |
1566 |
|
|
int nb_geo2_pts= surf2->get_vectorisation().get_nb_points(); |
1567 |
|
|
tns2_face=face2->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1568 |
|
|
tns2_surf=surf2->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
1569 |
|
|
vector<double2> ifac2; |
1570 |
|
|
vector<double2> isurf2; |
1571 |
|
|
for (int r=0;r<4;r++) |
1572 |
|
|
{ |
1573 |
|
|
ifac2.insert( ifac2.end(), tns2_face(r,r)); |
1574 |
|
|
isurf2.insert( isurf2.end(), tns2_surf(r,r)); |
1575 |
|
|
} |
1576 |
|
|
|
1577 |
|
|
if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts) |
1578 |
|
|
{ |
1579 |
|
|
vector<unsigned int> indx1,indx2; |
1580 |
|
|
if (tns1_face.listes_equivalentes(ifac1,ifac2,indx1)) |
1581 |
|
|
{ |
1582 |
|
|
if (tns1_face.listes_equivalentes(isurf1,isurf2,indx2)) |
1583 |
|
|
{ |
1584 |
|
|
ssim_tmp.ajouter(id1); |
1585 |
|
|
ssim_tmp.ajouter(id2); |
1586 |
|
|
} |
1587 |
|
|
} |
1588 |
|
|
} |
1589 |
|
|
|
1590 |
|
|
} |
1591 |
|
|
|
1592 |
|
|
} |
1593 |
|
|
if (modele==1) ssim1=ssim_tmp; |
1594 |
|
|
if (modele==2) ssim2=ssim_tmp; |
1595 |
|
|
|
1596 |
|
|
affecter_les_couleurs(laquelle); |
1597 |
|
|
} |
1598 |
|
|
|
1599 |
|
|
|
1600 |
|
|
|
1601 |
|
|
|
1602 |
|
|
TPL_LISTE_ENTITE<int> VCT_COMPARAISON::get_liste_des_identitees() |
1603 |
|
|
{ |
1604 |
|
|
return identite; |
1605 |
|
|
} |
1606 |
|
|
|
1607 |
|
|
TPL_LISTE_ENTITE<int> VCT_COMPARAISON::get_liste_des_simalarite_vectorielle(int type_comparais) |
1608 |
|
|
{ |
1609 |
|
|
TPL_LISTE_ENTITE<int> lst_tmp; |
1610 |
|
|
switch ( type_comparais) |
1611 |
|
|
{ |
1612 |
|
|
case 12: |
1613 |
|
|
lst_tmp= similarite; |
1614 |
|
|
case 1: |
1615 |
|
|
lst_tmp= sim1; |
1616 |
|
|
case 2: |
1617 |
|
|
lst_tmp= sim2; |
1618 |
|
|
} |
1619 |
|
|
return lst_tmp; |
1620 |
|
|
} |
1621 |
|
|
|
1622 |
|
|
TPL_LISTE_ENTITE<int> VCT_COMPARAISON::get_liste_des_simalarite_inertielle(int type_comparais) |
1623 |
|
|
{ |
1624 |
|
|
TPL_LISTE_ENTITE<int> lst_tmp; |
1625 |
|
|
switch ( type_comparais) |
1626 |
|
|
{ |
1627 |
|
|
case 12: |
1628 |
|
|
lst_tmp= ssimilarite; |
1629 |
|
|
case 1: |
1630 |
|
|
lst_tmp= ssim1; |
1631 |
|
|
case 2: |
1632 |
|
|
lst_tmp= ssim2; |
1633 |
|
|
} |
1634 |
|
|
return lst_tmp; |
1635 |
|
|
} |
1636 |
|
|
|
1637 |
|
|
|
1638 |
|
|
void VCT_COMPARAISON::affecter_les_couleurs(int niveau) |
1639 |
|
|
{ |
1640 |
|
|
//randomize(); |
1641 |
|
|
int nb_face_ident=similarite.get_nb()/2; |
1642 |
|
|
int nb_face_identt=ssimilarite.get_nb()/2; |
1643 |
|
|
int nb_face_iden=identite.get_nb()/2; |
1644 |
|
|
double val; |
1645 |
|
|
TPL_LISTE_ENTITE<int> lst; |
1646 |
|
|
TPL_LISTE_ENTITE<double> lst_val; |
1647 |
|
|
int num1,num2,num1_avant ; |
1648 |
|
|
if (niveau==1) //pour afficher les identites entre le deux mod�les |
1649 |
|
|
{ |
1650 |
|
|
for (int i=0;i< nb_face_iden;i++) |
1651 |
|
|
{ |
1652 |
|
|
num1=identite.get(2*i) ; |
1653 |
|
|
num2=identite.get(2*i+1) ; |
1654 |
|
|
if (i>0) num1_avant= identite.get(2*(i-1)); |
1655 |
|
|
MG_FACE* face1=mggeo1->get_mg_faceid(num1); |
1656 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(num2); |
1657 |
|
|
|
1658 |
|
|
if (i==0) |
1659 |
|
|
{ |
1660 |
|
|
choisir_une_couleur(val); |
1661 |
|
|
while (lst_val.est_dans_la_liste(val)) |
1662 |
|
|
{ |
1663 |
|
|
choisir_une_couleur(val); |
1664 |
|
|
} |
1665 |
|
|
face1->ajouter_ccf("Cc",val); |
1666 |
|
|
face2->ajouter_ccf("Cc",val); |
1667 |
|
|
lst_val.ajouter(val); |
1668 |
|
|
} |
1669 |
|
|
|
1670 |
|
|
if (i>0) |
1671 |
|
|
{ |
1672 |
|
|
if (num1!=num1_avant) |
1673 |
|
|
{ |
1674 |
|
|
choisir_une_couleur(val); |
1675 |
|
|
while (lst_val.est_dans_la_liste(val)) |
1676 |
|
|
{ |
1677 |
|
|
choisir_une_couleur(val); |
1678 |
|
|
} |
1679 |
|
|
face1->ajouter_ccf("Cc",val); |
1680 |
|
|
face2->ajouter_ccf("Cc",val); |
1681 |
|
|
lst_val.ajouter(val); |
1682 |
|
|
} |
1683 |
|
|
else { |
1684 |
|
|
face2->ajouter_ccf("Cc",val); |
1685 |
|
|
} |
1686 |
|
|
|
1687 |
|
|
} |
1688 |
|
|
} |
1689 |
|
|
|
1690 |
|
|
} |
1691 |
|
|
|
1692 |
|
|
if (niveau==21||niveau==22||niveau==23) //pour afficher la similarite entre le deux mod�le vectoriellement ou inertiellement |
1693 |
|
|
{ |
1694 |
|
|
TPL_LISTE_ENTITE<int> simu; |
1695 |
|
|
if (niveau==21)simu=similarite; |
1696 |
|
|
if (niveau==22) simu=ssimilarite; |
1697 |
|
|
if (niveau==23) simu=sim_double; |
1698 |
|
|
TPL_LISTE_ENTITE<int> llst1; |
1699 |
|
|
TPL_LISTE_ENTITE<int> llst2; |
1700 |
|
|
int nb_face_sim=simu.get_nb()/2.; |
1701 |
|
|
for (int i=0;i< nb_face_sim;i++) |
1702 |
|
|
{ |
1703 |
|
|
TPL_LISTE_ENTITE<int> lst1; |
1704 |
|
|
TPL_LISTE_ENTITE<int> lst2; |
1705 |
|
|
TPL_LISTE_ENTITE<int> llst3; |
1706 |
|
|
num1=simu.get(2*i) ; |
1707 |
|
|
if (!llst1.est_dans_la_liste(num1)) |
1708 |
|
|
{ |
1709 |
|
|
num2=simu.get(2*i+1) ; |
1710 |
|
|
lst1.ajouter(num1); |
1711 |
|
|
lst2.ajouter(num2); |
1712 |
|
|
llst1.ajouter(num1); |
1713 |
|
|
llst2.ajouter(num2); |
1714 |
|
|
for (int j=1;j< nb_face_sim;j++) |
1715 |
|
|
{ |
1716 |
|
|
int Num1=simu.get(2*j) ; |
1717 |
|
|
int Num2=simu.get(2*j+1) ; |
1718 |
|
|
|
1719 |
|
|
if (num1==Num1) |
1720 |
|
|
{ |
1721 |
|
|
llst3.ajouter(Num2); |
1722 |
|
|
} |
1723 |
|
|
if (num2==Num2||llst3.est_dans_la_liste(Num2)) |
1724 |
|
|
{ |
1725 |
|
|
if (!lst1.est_dans_la_liste(Num1)) { |
1726 |
|
|
lst1.ajouter(Num1); |
1727 |
|
|
llst1.ajouter(Num1); |
1728 |
|
|
} |
1729 |
|
|
if (!lst2.est_dans_la_liste(Num2)) { |
1730 |
|
|
lst2.ajouter(Num2); |
1731 |
|
|
llst2.ajouter(Num2); |
1732 |
|
|
} |
1733 |
|
|
} |
1734 |
|
|
|
1735 |
|
|
} |
1736 |
|
|
|
1737 |
|
|
choisir_une_couleur(val); |
1738 |
|
|
while (lst_val.est_dans_la_liste(val)) |
1739 |
|
|
{ |
1740 |
|
|
choisir_une_couleur(val); |
1741 |
|
|
} |
1742 |
|
|
lst_val.ajouter(val); |
1743 |
|
|
int nb1=lst1.get_nb(); |
1744 |
|
|
int nb2=lst2.get_nb(); |
1745 |
|
|
for (int i=0;i<nb1;i++) |
1746 |
|
|
{ |
1747 |
|
|
int n1=lst1.get(i); |
1748 |
|
|
MG_FACE* face1=mggeo1->get_mg_faceid(n1); |
1749 |
|
|
face1->ajouter_ccf("Cc",val); |
1750 |
|
|
} |
1751 |
|
|
for (int i=0;i<nb2;i++) |
1752 |
|
|
{ |
1753 |
|
|
int n2=lst2.get(i); |
1754 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(n2); |
1755 |
|
|
face2->ajouter_ccf("Cc",val); |
1756 |
|
|
} |
1757 |
|
|
|
1758 |
|
|
} |
1759 |
|
|
} |
1760 |
|
|
|
1761 |
|
|
|
1762 |
|
|
} |
1763 |
|
|
|
1764 |
|
|
if (niveau== 31||niveau==32) //pour afficher la similarite dans le premier mod�le ou le second modele |
1765 |
|
|
{ |
1766 |
|
|
|
1767 |
|
|
MG_GEOMETRIE *mgeo1 ; |
1768 |
|
|
int laquelle; |
1769 |
|
|
|
1770 |
|
|
switch (niveau) |
1771 |
|
|
{ |
1772 |
|
|
case 31: |
1773 |
|
|
{ |
1774 |
|
|
mgeo1=mggeo1; |
1775 |
|
|
laquelle=31; |
1776 |
|
|
break; |
1777 |
|
|
} |
1778 |
|
|
case 32: |
1779 |
|
|
{ |
1780 |
|
|
mgeo1=mggeo2; |
1781 |
|
|
laquelle=32; |
1782 |
|
|
break; |
1783 |
|
|
} |
1784 |
|
|
|
1785 |
|
|
} |
1786 |
|
|
|
1787 |
|
|
|
1788 |
|
|
for (int i=0;i< nb_face_identt;i++) |
1789 |
|
|
{ |
1790 |
|
|
num1=ssimilarite.get(2*i) ; |
1791 |
|
|
num2=ssimilarite.get(2*i+1) ; |
1792 |
|
|
|
1793 |
|
|
if (i>0) num1_avant= ssimilarite.get(2*(i-1)); |
1794 |
|
|
MG_FACE* face1=mgeo1->get_mg_faceid(num1); |
1795 |
|
|
MG_FACE* face2=mgeo1->get_mg_faceid(num2); |
1796 |
|
|
if (!lst.est_dans_la_liste(num2)) |
1797 |
|
|
{ |
1798 |
|
|
if (i==0) |
1799 |
|
|
{ |
1800 |
|
|
choisir_une_couleur(val); |
1801 |
|
|
while (lst_val.est_dans_la_liste(val)) |
1802 |
|
|
{ |
1803 |
|
|
choisir_une_couleur(val); |
1804 |
|
|
} |
1805 |
|
|
face1->ajouter_ccf("Cc",val); |
1806 |
|
|
if (num1!=num2) face2->ajouter_ccf("Cc",val); |
1807 |
|
|
lst.ajouter(num2); |
1808 |
|
|
lst_val.ajouter(val); |
1809 |
|
|
} |
1810 |
|
|
|
1811 |
|
|
if (i>0) |
1812 |
|
|
{ |
1813 |
|
|
if (num1!=num1_avant) |
1814 |
|
|
{ |
1815 |
|
|
choisir_une_couleur(val); |
1816 |
|
|
while (lst_val.est_dans_la_liste(val)) |
1817 |
|
|
{ |
1818 |
|
|
choisir_une_couleur(val); |
1819 |
|
|
} |
1820 |
|
|
face1->ajouter_ccf("Cc",val); |
1821 |
|
|
if (num1!=num2) face2->ajouter_ccf("Cc",val); |
1822 |
|
|
lst.ajouter(num2); |
1823 |
|
|
lst_val.ajouter(val); |
1824 |
|
|
} |
1825 |
|
|
else { |
1826 |
|
|
if (num1!=num2) face2->ajouter_ccf("Cc",val); |
1827 |
|
|
lst.ajouter(num2); |
1828 |
|
|
} |
1829 |
|
|
|
1830 |
|
|
} |
1831 |
|
|
} |
1832 |
|
|
} |
1833 |
|
|
|
1834 |
|
|
|
1835 |
|
|
} |
1836 |
|
|
|
1837 |
|
|
|
1838 |
|
|
} |
1839 |
|
|
|
1840 |
|
|
|
1841 |
|
|
void VCT_COMPARAISON::choisir_une_couleur(double& val) |
1842 |
|
|
{ |
1843 |
|
|
//randomize(); |
1844 |
|
|
|
1845 |
|
|
unsigned char r=rand() % 255; |
1846 |
|
|
unsigned char g=rand() % 255; |
1847 |
|
|
unsigned char b=rand() % 255; |
1848 |
|
|
val=0.; |
1849 |
|
|
unsigned char* p =(unsigned char*)&val; |
1850 |
|
|
|
1851 |
|
|
*p=r; |
1852 |
|
|
p++; |
1853 |
|
|
*p=g; |
1854 |
|
|
p++; |
1855 |
|
|
*p=b; |
1856 |
|
|
|
1857 |
|
|
} |
1858 |
|
|
|
1859 |
|
|
|
1860 |
|
|
void VCT_COMPARAISON::trouve_face_de_reference(int &face_ref1,int &face_ref2)// ,TPL_LISTE_ENTITE<int>& list |
1861 |
|
|
{ |
1862 |
|
|
|
1863 |
|
|
/* |
1864 |
|
|
int nb_simdble=sim_double.get_nb()/2 ; |
1865 |
|
|
|
1866 |
|
|
int num1,num2 ; |
1867 |
|
|
|
1868 |
|
|
|
1869 |
|
|
OT_VECTEUR_4DD Dv,Dv1,Dv2,G1,G2,g1g2; |
1870 |
|
|
OT_TENSEUR V(4),V1(4),V2(4); |
1871 |
|
|
|
1872 |
|
|
|
1873 |
|
|
int nbsim=nb_sim.get_nb(); |
1874 |
|
|
int *t=new int [nbsim]; |
1875 |
|
|
int *tt=new int [nbsim]; |
1876 |
|
|
for(int i=0;i<nbsim;i++) |
1877 |
|
|
{ |
1878 |
|
|
// t[i]= nb_sim.get(i); |
1879 |
|
|
t[i]= i; |
1880 |
|
|
int nbre_faces_simil=nb_sim.get(i); |
1881 |
|
|
tt[i]=nbre_faces_simil; |
1882 |
|
|
|
1883 |
|
|
} |
1884 |
|
|
int pos_min,pos_max; |
1885 |
|
|
int min,max; |
1886 |
|
|
int trouve=0; |
1887 |
|
|
|
1888 |
|
|
for (int i=0;i<nbsim;i++) |
1889 |
|
|
{ |
1890 |
|
|
|
1891 |
|
|
for(int j=0;j<nbsim;j++) |
1892 |
|
|
{ |
1893 |
|
|
if(tt[j]<tt[i]) |
1894 |
|
|
{ |
1895 |
|
|
int tmp= tt[i]; |
1896 |
|
|
|
1897 |
|
|
tt[i]= tt[j]; |
1898 |
|
|
tt[j]= tmp; |
1899 |
|
|
t[i]=j; |
1900 |
|
|
t[j]=i; |
1901 |
|
|
} |
1902 |
|
|
} |
1903 |
|
|
} |
1904 |
|
|
|
1905 |
|
|
|
1906 |
|
|
//pos_max=t[1]; |
1907 |
|
|
|
1908 |
|
|
if(tt[0]==1) |
1909 |
|
|
{ |
1910 |
|
|
pos_min=t[0]; |
1911 |
|
|
MG_FACE* fref=mggeo1->get_mg_face(pos_min); |
1912 |
|
|
face_ref1= fref->get_id(); |
1913 |
|
|
for(int i=0;i<nb_simdble;i++){ |
1914 |
|
|
if (sim_double.get(2*i)==face_ref1) |
1915 |
|
|
face_ref2=sim_double.get(2*i+1); |
1916 |
|
|
} |
1917 |
|
|
return; |
1918 |
|
|
} |
1919 |
|
|
|
1920 |
|
|
|
1921 |
|
|
int pos1=0; |
1922 |
|
|
int pos2=0; |
1923 |
|
|
|
1924 |
|
|
int tr=0; |
1925 |
|
|
trouve=0; |
1926 |
|
|
while(trouve==0&&tr<nbsim-1) |
1927 |
|
|
{ |
1928 |
|
|
pos_min=t[tr]; |
1929 |
|
|
pos_max=t[tr+1]; |
1930 |
|
|
|
1931 |
|
|
OT_VECTEUR_4DD g1_ref,g2_ref,G1_ref,G2_ref; |
1932 |
|
|
MG_FACE* face1_ref=mggeo1->get_mg_face(pos_min); |
1933 |
|
|
MG_SURFACE* surf1_ref=face1_ref->get_surface(); |
1934 |
|
|
int id1=face1_ref->get_id(); |
1935 |
|
|
face1_ref->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
1936 |
|
|
G1_ref= face1_ref->get_vectorisation().calcule_barycentre(T1); |
1937 |
|
|
/* |
1938 |
|
|
for(int r=0;r<4;r++) { |
1939 |
|
|
for(int s=0;s<4;s++) { |
1940 |
|
|
g1_ref[r]= g1_ref[r]+V1(s,r)*G1_ref[s]; |
1941 |
|
|
} |
1942 |
|
|
} |
1943 |
|
|
/ |
1944 |
|
|
g1_ref=face1_ref->get_vectorisation().get_nouveau_pt(T1,G1_ref); |
1945 |
|
|
/* OT_TENSEUR ttns1_face=face1_ref->get_vectorisation().calcule_tenseur_inertie_base_locale(); |
1946 |
|
|
vector<double2> ifac1; |
1947 |
|
|
for(int r=0;r<4;r++) |
1948 |
|
|
{ |
1949 |
|
|
ifac1.insert( ifac2.end(), ttns1_face(r,r)); |
1950 |
|
|
} / |
1951 |
|
|
|
1952 |
|
|
MG_FACE* face12_ref=mggeo1->get_mg_face(pos_max); |
1953 |
|
|
face12_ref->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
1954 |
|
|
int id2=face12_ref->get_id(); |
1955 |
|
|
G2_ref= face12_ref->get_vectorisation().calcule_barycentre(T2); |
1956 |
|
|
/* |
1957 |
|
|
for(int r=0;r<4;r++) { |
1958 |
|
|
for(int s=0;s<4;s++) { |
1959 |
|
|
g2_ref[r]= g2_ref[r]+V1(s,r)*G2_ref[s]; |
1960 |
|
|
} |
1961 |
|
|
} |
1962 |
|
|
/ |
1963 |
|
|
g2_ref=face12_ref->get_vectorisation().get_nouveau_pt(T1,G2_ref); |
1964 |
|
|
|
1965 |
|
|
OT_VECTEUR_4DD g12_ref= g2_ref -g1_ref; |
1966 |
|
|
|
1967 |
|
|
|
1968 |
|
|
OT_VECTEUR_4DD g1refg1,g2refg2; |
1969 |
|
|
TPL_LISTE_ENTITE<int> lst1,lst2; |
1970 |
|
|
for(int k=0;k<nb_simdble;k++) |
1971 |
|
|
{ |
1972 |
|
|
if(sim_double.get(2*k)==id1) |
1973 |
|
|
lst1.ajouter( sim_double.get(2*k+1)); |
1974 |
|
|
if(sim_double.get(2*k)==id2) |
1975 |
|
|
lst2.ajouter(sim_double.get(2*k+1)); |
1976 |
|
|
} |
1977 |
|
|
|
1978 |
|
|
|
1979 |
|
|
|
1980 |
|
|
|
1981 |
|
|
for(int i=0;i<lst1.get_nb();i++) |
1982 |
|
|
{ |
1983 |
|
|
|
1984 |
|
|
int num1=lst1.get(i); |
1985 |
|
|
OT_VECTEUR_4DD g1,G1; |
1986 |
|
|
MG_FACE* face1=mggeo2->get_mg_faceid(num1); |
1987 |
|
|
face1->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
1988 |
|
|
G1= face1->get_vectorisation().calcule_barycentre(T2); |
1989 |
|
|
/* |
1990 |
|
|
for(int r=0;r<4;r++) { |
1991 |
|
|
for(int s=0;s<4;s++) { |
1992 |
|
|
g1[r]= g1[r]+V2(s,r)*G1[s]; |
1993 |
|
|
} |
1994 |
|
|
} |
1995 |
|
|
/ |
1996 |
|
|
// g1refg1=g1-g1_ref; |
1997 |
|
|
// num2=list.get(2*i+1); |
1998 |
|
|
for(int j=0;j<lst2.get_nb();j++) |
1999 |
|
|
{ |
2000 |
|
|
int num2=lst2.get(j); |
2001 |
|
|
OT_VECTEUR_4DD g2; |
2002 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(num2); |
2003 |
|
|
G2= face2->get_vectorisation().calcule_barycentre(T2); |
2004 |
|
|
/* |
2005 |
|
|
for(int r=0;r<4;r++) { |
2006 |
|
|
for(int s=0;s<4;s++) { |
2007 |
|
|
g2[r]= g2[r]+V2(s,r)*G2[s]; |
2008 |
|
|
} |
2009 |
|
|
} |
2010 |
|
|
/ |
2011 |
|
|
//OT_VECTEUR_4DD g2g1=g2-g1; |
2012 |
|
|
OT_VECTEUR_4DD g2g1=G2-G1; |
2013 |
|
|
if(g2g1==g12_ref) |
2014 |
|
|
{ |
2015 |
|
|
// lst_fin.ajouter(num1); |
2016 |
|
|
// lst_fin.ajouter(num2); |
2017 |
|
|
face_ref1=id1; |
2018 |
|
|
face_ref2=num1; |
2019 |
|
|
trouve=1; |
2020 |
|
|
break; |
2021 |
|
|
} |
2022 |
|
|
} |
2023 |
|
|
if(trouve) break; |
2024 |
|
|
} |
2025 |
|
|
tr++; |
2026 |
|
|
} |
2027 |
|
|
delete [] t; |
2028 |
|
|
delete [] tt; |
2029 |
|
|
*/ |
2030 |
|
|
|
2031 |
|
|
int p=0; |
2032 |
|
|
int h=0; |
2033 |
|
|
int not_trouve=0; |
2034 |
|
|
while (!not_trouve) |
2035 |
|
|
{ |
2036 |
|
|
MG_FACE* face1Ref=mggeo1->get_mg_faceid(sim_double.get(p)); |
2037 |
|
|
MG_SURFACE* surf1Ref=face1Ref->get_surface(); |
2038 |
|
|
OT_VECTEUR_4DD G1=surf1Ref->get_vectorisation().calcule_barycentre(T1); |
2039 |
|
|
G1= surf1Ref->get_vectorisation().get_nouveau_pt(T1,G1); |
2040 |
|
|
|
2041 |
|
|
int idRef1=face1Ref->get_id(); |
2042 |
|
|
|
2043 |
|
|
int k=0; |
2044 |
|
|
while (idRef1==sim_double.get(2*k+h)) |
2045 |
|
|
{ |
2046 |
|
|
MG_FACE* face2Ref=mggeo2->get_mg_faceid(sim_double.get(2*k+1)); |
2047 |
|
|
int idRef2=face2Ref->get_id(); |
2048 |
|
|
MG_SURFACE* surf2Ref=face2Ref->get_surface(); |
2049 |
|
|
OT_VECTEUR_4DD G2=surf2Ref->get_vectorisation().calcule_barycentre(T2); |
2050 |
|
|
// if (G1==G2) |
2051 |
|
|
if (surfaces_sont_elles_identiques(face1Ref,face2Ref)) |
2052 |
|
|
{ |
2053 |
|
|
face_ref1=idRef1; |
2054 |
|
|
face_ref2=idRef2; |
2055 |
|
|
not_trouve=1; |
2056 |
|
|
break; |
2057 |
|
|
} |
2058 |
|
|
k++; |
2059 |
|
|
p=p+2; |
2060 |
|
|
} |
2061 |
|
|
h=p; |
2062 |
|
|
} |
2063 |
|
|
} |
2064 |
|
|
|
2065 |
|
|
|
2066 |
|
|
void VCT_COMPARAISON::verifier_le_repere(OT_TENSEUR& rep1,OT_TENSEUR& rep2,vector<double2>& inert1,vector<double2>& inert2) |
2067 |
|
|
{ |
2068 |
|
|
TPL_LISTE_ENTITE<int> lst; |
2069 |
|
|
for (int i=0;i<4;i++) |
2070 |
|
|
{ |
2071 |
|
|
double2 val1=inert1[i]; |
2072 |
|
|
for (int j=0;j<4;j++) |
2073 |
|
|
{ |
2074 |
|
|
if (!lst.est_dans_la_liste(j+4)) |
2075 |
|
|
{ |
2076 |
|
|
double2 val2=inert2[j]; |
2077 |
|
|
if (val1==val2) |
2078 |
|
|
{ |
2079 |
|
|
lst.ajouter(i); |
2080 |
|
|
lst.ajouter(j+4); |
2081 |
|
|
break; |
2082 |
|
|
} |
2083 |
|
|
} |
2084 |
|
|
} |
2085 |
|
|
} |
2086 |
|
|
|
2087 |
|
|
|
2088 |
|
|
} |
2089 |
|
|
|
2090 |
|
|
|
2091 |
|
|
int VCT_COMPARAISON::comparer_aretes_faces(MG_FACE* f_ref1,MG_FACE* f_ref2,MG_FACE* face1,MG_FACE* face2,TPL_LISTE_ENTITE<int>& aretes_ident,TPL_LISTE_ENTITE<int>& aretes_sim) |
2092 |
|
|
{ |
2093 |
|
|
|
2094 |
|
|
|
2095 |
|
|
int nb_boucle1=face1->get_nb_mg_boucle(); |
2096 |
|
|
int nb_boucle2=face2->get_nb_mg_boucle(); |
2097 |
|
|
TPL_LISTE_ENTITE<int> lst1_artes_delamemecourbe; |
2098 |
|
|
TPL_LISTE_ENTITE<int> lst2_artes_delamemecourbe; |
2099 |
|
|
TPL_LISTE_ENTITE<int> arte1_trouvee; |
2100 |
|
|
TPL_LISTE_ENTITE<int> arte2_trouvee; |
2101 |
|
|
OT_VECTEUR_4DD VZER(0.,0.,0.,0.); |
2102 |
|
|
//----------------------------------------------------------------------------- |
2103 |
|
|
OT_VECTEUR_4DD Dv1,Dv2,G1,gf1,gf2,G2; |
2104 |
|
|
OT_TENSEUR V1(4),V2(4); |
2105 |
|
|
|
2106 |
|
|
//f_ref1->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
2107 |
|
|
//G1=f_ref1->get_vectorisation().calcule_barycentre(T1); |
2108 |
|
|
|
2109 |
|
|
MG_SURFACE* surf1_ref=f_ref1->get_surface(); |
2110 |
|
|
G1=surf1_ref->get_vectorisation().calcule_barycentre(T1); |
2111 |
|
|
G1=surf1_ref->get_vectorisation().get_nouveau_pt(T1,G1); |
2112 |
|
|
// for(int r=0;r<4;r++) { |
2113 |
|
|
// for(int s=0;s<4;s++) { |
2114 |
|
|
// gf1[r]= gf1[r]+V1(s,r)*G1[s]; |
2115 |
|
|
// } |
2116 |
|
|
// } |
2117 |
|
|
|
2118 |
|
|
//f_ref2->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
2119 |
|
|
//G2=f_ref2->get_vectorisation().calcule_barycentre(T2); |
2120 |
|
|
MG_SURFACE* surf2_ref= f_ref2->get_surface(); |
2121 |
|
|
G2=surf1_ref->get_vectorisation().calcule_barycentre(T2); |
2122 |
|
|
|
2123 |
|
|
// for(int r=0;r<4;r++) { |
2124 |
|
|
// for(int s=0;s<4;s++) { |
2125 |
|
|
// gf2[r]= gf2[r]+V2(s,r)*G2[s]; |
2126 |
|
|
// } |
2127 |
|
|
// } |
2128 |
|
|
|
2129 |
|
|
//--------------------------------------------------------------------------- |
2130 |
|
|
/* for(int j1=0;j1<nb_boucle1;j1++) |
2131 |
|
|
{ |
2132 |
|
|
MG_BOUCLE* Boucle1 = face1->get_mg_boucle(j1); |
2133 |
|
|
int nbarete1 = Boucle1->get_nb_mg_coarete(); |
2134 |
|
|
for (int w1 =0; w1<nbarete1;w1++) |
2135 |
|
|
{ |
2136 |
|
|
double xyz1[3]; |
2137 |
|
|
double xyz2[3]; |
2138 |
|
|
vector<double2> viarte1,vicrbe1; |
2139 |
|
|
OT_TENSEUR tns_arete1(4),tns_courbe1(4); |
2140 |
|
|
OT_TENSEUR tm1_art(4),tm1_crb(4); |
2141 |
|
|
MG_COARETE* coArete1 = Boucle1->get_mg_coarete(w1); |
2142 |
|
|
MG_ARETE* arete1 = coArete1->get_arete(); |
2143 |
|
|
int id_art1=arete1->get_id(); |
2144 |
|
|
MG_COURBE* courbe1=arete1->get_courbe(); |
2145 |
|
|
int nb_top1_pts= arete1->get_vectorisation().get_nb_points(); |
2146 |
|
|
int nb_geo1_pts= courbe1->get_vectorisation().get_nb_points(); |
2147 |
|
|
tm1_art=arete1->get_vectorisation().calcule_tenseur_metrique(); |
2148 |
|
|
tm1_crb=courbe1->get_vectorisation().calcule_tenseur_metrique(); |
2149 |
|
|
tns_arete1=arete1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
2150 |
|
|
tns_courbe1=courbe1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
2151 |
|
|
|
2152 |
|
|
for(int r=0;r<4;r++) |
2153 |
|
|
{ |
2154 |
|
|
viarte1.insert( viarte1.end(), tns_arete1(r,r)); |
2155 |
|
|
vicrbe1.insert( vicrbe1.end(), tns_courbe1(r,r)); |
2156 |
|
|
} |
2157 |
|
|
for(int j2=0;j2<nb_boucle2;j2++) |
2158 |
|
|
{ |
2159 |
|
|
MG_BOUCLE* Boucle2 = face2->get_mg_boucle(j2); |
2160 |
|
|
int nbarete2 = Boucle2->get_nb_mg_coarete(); |
2161 |
|
|
for (int w2 =0; w2<nbarete2;w2++) |
2162 |
|
|
{ |
2163 |
|
|
double xyz1[3]; |
2164 |
|
|
double xyz2[3]; |
2165 |
|
|
vector<double2> viarte2,vicrbe2; |
2166 |
|
|
OT_TENSEUR tns_arete2(4),tns_courbe2(4); |
2167 |
|
|
OT_TENSEUR tm2_art(4),tm2_crb(4); |
2168 |
|
|
MG_COARETE* coArete2 = Boucle2->get_mg_coarete(w2); |
2169 |
|
|
MG_ARETE* arete2 = coArete2->get_arete(); |
2170 |
|
|
int id_art2=arete2->get_id(); |
2171 |
|
|
MG_COURBE* courbe2=arete2->get_courbe(); |
2172 |
|
|
int nb_top2_pts= arete2->get_vectorisation().get_nb_points(); |
2173 |
|
|
int nb_geo2_pts= courbe2->get_vectorisation().get_nb_points(); |
2174 |
|
|
tm2_art=arete2->get_vectorisation().calcule_tenseur_metrique(); |
2175 |
|
|
tm2_crb=courbe2->get_vectorisation().calcule_tenseur_metrique(); |
2176 |
|
|
tns_arete2=arete2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
2177 |
|
|
tns_courbe2=courbe2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
2178 |
|
|
|
2179 |
|
|
for(int r=0;r<4;r++) |
2180 |
|
|
{ |
2181 |
|
|
viarte2.insert( viarte2.end(), tns_arete1(r,r)); |
2182 |
|
|
vicrbe2.insert( vicrbe2.end(), tns_courbe1(r,r)); |
2183 |
|
|
} |
2184 |
|
|
if((nb_geo1_pts==nb_geo2_pts)&&(nb_top1_pts==nb_top2_pts)) |
2185 |
|
|
{ |
2186 |
|
|
if(tm1_art.est_til_equivalent(tm2_art)) |
2187 |
|
|
{ |
2188 |
|
|
if(tm1_crb.est_til_equivalent(tm2_crb)) |
2189 |
|
|
{ |
2190 |
|
|
if(tns_courbe1==tns_courbe2) |
2191 |
|
|
{ |
2192 |
|
|
lst1_artes_delamemecourbe.ajouter(id_art1); |
2193 |
|
|
lst2_artes_delamemecourbe.ajouter(id_art2); |
2194 |
|
|
} |
2195 |
|
|
} |
2196 |
|
|
} |
2197 |
|
|
|
2198 |
|
|
|
2199 |
|
|
} |
2200 |
|
|
|
2201 |
|
|
|
2202 |
|
|
} |
2203 |
|
|
} |
2204 |
|
|
} |
2205 |
|
|
} |
2206 |
|
|
|
2207 |
|
|
vector<OT_VECTEUR_4DD> lst1_barycentre; |
2208 |
|
|
vector<OT_VECTEUR_4DD> lst2_barycentre; |
2209 |
|
|
TPL_LISTE_ENTITE<int> lst1,lst2; |
2210 |
|
|
for(int i1=0;i1<lst2_artes_delamemecourbe.get_nb();i1++) |
2211 |
|
|
{ |
2212 |
|
|
int id21=lst2_artes_delamemecourbe.get(i1); |
2213 |
|
|
MG_ARETE* art2=mggeo2->get_mg_areteid(id21); |
2214 |
|
|
OT_VECTEUR_4DD G2=art2->get_vectorisation().calcule_barycentre(T2); |
2215 |
|
|
if(!lst2.est_dans_la_liste(id21)) |
2216 |
|
|
{ |
2217 |
|
|
lst2_barycentre.insert(lst2_barycentre.end(),G2); |
2218 |
|
|
for(int i2=0;i2<lst2_artes_delamemecourbe.get_nb();i2++) |
2219 |
|
|
{ |
2220 |
|
|
int id22=lst2_artes_delamemecourbe.get(i2); |
2221 |
|
|
int id1=lst1_artes_delamemecourbe.get(i2);REMAILLEUR |
2222 |
|
|
if(!lst1.est_dans_la_liste(id1)) |
2223 |
|
|
{ |
2224 |
|
|
if(id21==id22) |
2225 |
|
|
{ |
2226 |
|
|
MG_ARETE* art1=mggeo1->get_mg_areteid(id1); |
2227 |
|
|
OT_VECTEUR_4DD G1=art1->get_vectorisation().calcule_barycentre(T1); |
2228 |
|
|
G1=art1->get_vectorisation().get_nouveau_pt(T1,G1); |
2229 |
|
|
lst1_barycentre.insert(lst1_barycentre.end(),G1); |
2230 |
|
|
lst1.ajouter(id1); |
2231 |
|
|
} |
2232 |
|
|
} |
2233 |
|
|
} |
2234 |
|
|
lst2.ajouter(id21); |
2235 |
|
|
} |
2236 |
|
|
} |
2237 |
|
|
|
2238 |
|
|
|
2239 |
|
|
vector<double2> NOR1,NOR2; |
2240 |
|
|
vector<OT_VECTEUR_4DD> vi,vj; |
2241 |
|
|
OT_VECTEUR_4DD g1=lst1_barycentre[0]; |
2242 |
|
|
for(int k=0;k<lst1_barycentre.size();k++) |
2243 |
|
|
{ |
2244 |
|
|
OT_VECTEUR_4DD gigj_1=lst1_barycentre[k]-g1; |
2245 |
|
|
|
2246 |
|
|
double2 nor1=gigj_1.norme(); |
2247 |
|
|
OT_VECTEUR_4DD gigj_2=lst1_barycentre[k]-g1; |
2248 |
|
|
double2 nor2=gigj_2.norme(); |
2249 |
|
|
} |
2250 |
|
|
for(int k=0;k<lst1_barycentre.size();k++) |
2251 |
|
|
{ |
2252 |
|
|
OT_VECTEUR_4DD gigj_1=lst1_barycentre[k]-g1; |
2253 |
|
|
vi.insert(vi.end(),gigj_1); |
2254 |
|
|
double2 nor1=gigj_1.norme(); |
2255 |
|
|
NOR1.insert(NOR1.end(),nor1); |
2256 |
|
|
OT_VECTEUR_4DD gigj_2=lst1_barycentre[k]-g1; |
2257 |
|
|
vj.insert(vj.end(),gigj_2); |
2258 |
|
|
double2 nor2=gigj_2.norme(); |
2259 |
|
|
NOR2.insert(NOR2.end(),nor2); |
2260 |
|
|
} |
2261 |
|
|
|
2262 |
|
|
double2 min1=NOR1[0]; |
2263 |
|
|
double2 min2=NOR2[0]; |
2264 |
|
|
int *t1=new int[lst1.get_nb()]; |
2265 |
|
|
int *t2=new int[lst2.get_nb()]; |
2266 |
|
|
|
2267 |
|
|
for(int r=0;r<lst1.get_nb();r++) |
2268 |
|
|
{ |
2269 |
|
|
t1[r]=lst1.get(r); |
2270 |
|
|
t2[r]=lst2.get(r); |
2271 |
|
|
for(int s=0;s<lst1.get_nb();s++) |
2272 |
|
|
{ |
2273 |
|
|
if (NOR1[s]<NOR1[r]) |
2274 |
|
|
{ |
2275 |
|
|
double2 tmp1=NOR1[r]; |
2276 |
|
|
NOR1[r]=NOR1[s]; |
2277 |
|
|
NOR1[s]=tmp1; |
2278 |
|
|
t1[r]=t1[s]; |
2279 |
|
|
} |
2280 |
|
|
|
2281 |
|
|
if (NOR2[s]<NOR2[r]) |
2282 |
|
|
{ |
2283 |
|
|
double2 tmp2=NOR2[r]; |
2284 |
|
|
NOR2[r]=NOR2[s]; |
2285 |
|
|
NOR2[s]=tmp2; |
2286 |
|
|
t2[r]=t2[s]; |
2287 |
|
|
} |
2288 |
|
|
} |
2289 |
|
|
} */ |
2290 |
|
|
//--------------------------------------------------------------------------- |
2291 |
|
|
int nb_aretes=0; |
2292 |
|
|
for (int j1=0;j1<nb_boucle1;j1++) |
2293 |
|
|
{ |
2294 |
|
|
MG_BOUCLE* Boucle1 = face1->get_mg_boucle(j1); |
2295 |
|
|
int nbarete1 = Boucle1->get_nb_mg_coarete(); |
2296 |
|
|
nb_aretes+=nbarete1; |
2297 |
|
|
for (int w1 =0; w1<nbarete1;w1++) |
2298 |
|
|
{ |
2299 |
|
|
double xyz1[3]; |
2300 |
|
|
double xyz2[3]; |
2301 |
|
|
OT_TENSEUR tns_arete1(4),tns_courbe1(4); |
2302 |
|
|
OT_TENSEUR tm1_art(4),tm1_crb(4); |
2303 |
|
|
MG_COARETE* coArete1 = Boucle1->get_mg_coarete(w1); |
2304 |
|
|
MG_ARETE* arete1 = coArete1->get_arete(); |
2305 |
|
|
int id_art1=arete1->get_id(); |
2306 |
|
|
|
2307 |
|
|
MG_COURBE* courbe1=arete1->get_courbe(); |
2308 |
|
|
|
2309 |
|
|
int nb_top1_pts= arete1->get_vectorisation().get_nb_points(); |
2310 |
|
|
int nb_geo1_pts= courbe1->get_vectorisation().get_nb_points(); |
2311 |
|
|
|
2312 |
|
|
tm1_art=arete1->get_vectorisation().calcule_tenseur_metrique(); |
2313 |
|
|
tm1_crb=courbe1->get_vectorisation().calcule_tenseur_metrique(); |
2314 |
|
|
|
2315 |
|
|
MG_COSOMMET* csomt1_art1= arete1->get_cosommet1(); |
2316 |
|
|
MG_COSOMMET* csomt2_art1= arete1->get_cosommet2(); |
2317 |
|
|
MG_SOMMET* som1_art1= csomt1_art1->get_sommet(); |
2318 |
|
|
MG_SOMMET* som2_art1= csomt2_art1->get_sommet(); |
2319 |
|
|
MG_POINT* pt1=som1_art1->get_point(); |
2320 |
|
|
MG_POINT* pt2=som2_art1->get_point(); |
2321 |
|
|
pt1->evaluer(xyz1); |
2322 |
|
|
OT_VECTEUR_4DD PT11(xyz1[0],xyz1[1],xyz1[2],0); |
2323 |
|
|
pt2->evaluer(xyz2); |
2324 |
|
|
OT_VECTEUR_4DD PT12(xyz2[0],xyz2[1],xyz2[2],0); |
2325 |
|
|
//---------------------------------------------------------------------- |
2326 |
|
|
OT_VECTEUR_4DD B1,g1; |
2327 |
|
|
B1=courbe1->get_vectorisation().calcule_barycentre(T1); |
2328 |
|
|
OT_VECTEUR_4DD G1S1=B1-PT11; |
2329 |
|
|
|
2330 |
|
|
B1=courbe1->get_vectorisation().get_nouveau_pt(T1,B1); |
2331 |
|
|
G1S1=courbe1->get_vectorisation().get_nouveau_pt(T1,G1S1); |
2332 |
|
|
// for(int r=0;r<4;r++) { |
2333 |
|
|
// for(int s=0;s<4;s++) |
2334 |
|
|
// g1[r]= g1[r]+V1(s,r)*B1[s]; |
2335 |
|
|
// } |
2336 |
|
|
//---------------------------------------------------------------------- |
2337 |
|
|
|
2338 |
|
|
tns_arete1=arete1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
2339 |
|
|
tns_courbe1=courbe1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
2340 |
|
|
vector<double2> viarte1,vicrbe1; |
2341 |
|
|
for (int r=0;r<4;r++) |
2342 |
|
|
{ |
2343 |
|
|
viarte1.insert( viarte1.end(), tns_arete1(r,r)); |
2344 |
|
|
vicrbe1.insert( vicrbe1.end(), tns_courbe1(r,r)); |
2345 |
|
|
} |
2346 |
|
|
int compt_aretes_modif=0; |
2347 |
|
|
for (int j2=0;j2<nb_boucle2;j2++) |
2348 |
|
|
{ |
2349 |
|
|
if (arte1_trouvee.est_dans_la_liste(id_art1)) break; |
2350 |
|
|
MG_BOUCLE* Boucle2 = face2->get_mg_boucle(j2); |
2351 |
|
|
int nbarete2 = Boucle2->get_nb_mg_coarete(); |
2352 |
|
|
for (int w2 =0; w2<nbarete2;w2++) |
2353 |
|
|
{ |
2354 |
|
|
if (arte1_trouvee.est_dans_la_liste(id_art1)) break; |
2355 |
|
|
OT_TENSEUR tns_arete2(4),tns_courbe2(4); |
2356 |
|
|
OT_TENSEUR tm2_art(4),tm2_crb(4); |
2357 |
|
|
MG_COARETE* coArete2 = Boucle2->get_mg_coarete(w2); |
2358 |
|
|
MG_ARETE* arete2 = coArete2->get_arete(); |
2359 |
|
|
MG_COURBE* courbe2=arete2->get_courbe(); |
2360 |
|
|
int id_art2=arete2->get_id(); |
2361 |
|
|
MG_COSOMMET* csomt1_art2= arete2->get_cosommet1(); |
2362 |
|
|
MG_COSOMMET* csomt2_art2= arete2->get_cosommet2(); |
2363 |
|
|
MG_SOMMET* som1_art2= csomt1_art2->get_sommet(); |
2364 |
|
|
MG_SOMMET* som2_art2= csomt2_art2->get_sommet(); |
2365 |
|
|
MG_POINT* pt2=som1_art2->get_point(); |
2366 |
|
|
pt2->evaluer(xyz1); |
2367 |
|
|
OT_VECTEUR_4DD PT21(xyz1[0],xyz1[1],xyz1[2],0); |
2368 |
|
|
MG_POINT* pt3=som2_art2->get_point(); |
2369 |
|
|
pt3->evaluer(xyz2); |
2370 |
|
|
OT_VECTEUR_4DD PT22(xyz2[0],xyz2[1],xyz2[2],0); |
2371 |
|
|
//---------------------------------------------------------------------- |
2372 |
|
|
OT_VECTEUR_4DD B2,g2; |
2373 |
|
|
B2=courbe2->get_vectorisation().calcule_barycentre(T2); |
2374 |
|
|
OT_VECTEUR_4DD G2S2=B2-PT21; |
2375 |
|
|
OT_VECTEUR_4DD G2S3=B2-PT22; |
2376 |
|
|
OT_VECTEUR_4DD B1B2=B2-B1; |
2377 |
|
|
OT_VECTEUR_4DD D1= G1S1^G2S2; |
2378 |
|
|
OT_VECTEUR_4DD D2= G1S1^G2S3; |
2379 |
|
|
// OT_VECTEUR_4DD D3= B1B2^G2S3; |
2380 |
|
|
// for(int r=0;r<4;r++) { |
2381 |
|
|
// for(int s=0;s<4;s++) |
2382 |
|
|
// g2[r]= g2[r]+V2(s,r)*B2[s]; |
2383 |
|
|
// } |
2384 |
|
|
//---------------------------------------------------------------------- MG_COURBE* courbe2=arete2->get_courbe(); |
2385 |
|
|
|
2386 |
|
|
int nb_top2_pts= arete2->get_vectorisation().get_nb_points(); |
2387 |
|
|
int nb_geo2_pts= courbe2->get_vectorisation().get_nb_points(); |
2388 |
|
|
|
2389 |
|
|
tm2_art=arete2->get_vectorisation().calcule_tenseur_metrique(); |
2390 |
|
|
tm2_crb=courbe2->get_vectorisation().calcule_tenseur_metrique(); |
2391 |
|
|
|
2392 |
|
|
tns_arete2=arete2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
2393 |
|
|
tns_courbe2=courbe2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
2394 |
|
|
|
2395 |
|
|
vector<double2> viarte2,vicrbe2; |
2396 |
|
|
for (int r=0;r<4;r++) |
2397 |
|
|
{ |
2398 |
|
|
viarte2.insert( viarte2.end(), tns_arete2(r,r)); |
2399 |
|
|
vicrbe2.insert( vicrbe2.end(), tns_courbe2(r,r)); |
2400 |
|
|
} |
2401 |
|
|
|
2402 |
|
|
if (nb_geo1_pts==nb_geo2_pts&&nb_top1_pts==nb_top2_pts) |
2403 |
|
|
{ |
2404 |
|
|
if (tm1_art.est_til_equivalent(tm2_art)) |
2405 |
|
|
{ |
2406 |
|
|
if (tm1_crb.est_til_equivalent(tm2_crb)) |
2407 |
|
|
{ |
2408 |
|
|
vector<unsigned int> indx1,indx2; |
2409 |
|
|
int identique=-1; |
2410 |
|
|
//if(tns_arete1==tns_arete2)//.listes_equivalentes(viarte1,viarte2,indx1)) |
2411 |
|
|
//{ |
2412 |
|
|
if (tns_courbe1==tns_courbe2)//tns_arete1.listes_equivalentes(vicrbe1,vicrbe2,indx2)) |
2413 |
|
|
{ |
2414 |
|
|
OT_VECTEUR_4DD v1=B1-G1; |
2415 |
|
|
OT_VECTEUR_4DD v2=B2-G2; |
2416 |
|
|
//OT_VECTEUR_4DD v1=gf1-g1; |
2417 |
|
|
//OT_VECTEUR_4DD v2=gf2-g2; |
2418 |
|
|
//if(v1==v2||((D1==VZER||D2==VZER))) |
2419 |
|
|
if (courbes_sont_elles_identiques(arete1,arete2)) |
2420 |
|
|
{ |
2421 |
|
|
if (!arte2_trouvee.est_dans_la_liste(id_art2)) |
2422 |
|
|
{ |
2423 |
|
|
aretes_ident.ajouter(j1) ; |
2424 |
|
|
aretes_ident.ajouter(id_art1) ; |
2425 |
|
|
aretes_ident.ajouter(j2) ; |
2426 |
|
|
aretes_ident.ajouter(id_art2) ; |
2427 |
|
|
arte1_trouvee.ajouter(id_art1); |
2428 |
|
|
arte2_trouvee.ajouter(id_art2); |
2429 |
|
|
identique=1; |
2430 |
|
|
} |
2431 |
|
|
|
2432 |
|
|
|
2433 |
|
|
} |
2434 |
|
|
|
2435 |
|
|
} |
2436 |
|
|
// } |
2437 |
|
|
if (identique>0) break; |
2438 |
|
|
if (identique<0) |
2439 |
|
|
{ |
2440 |
|
|
aretes_sim.ajouter(j1) ; |
2441 |
|
|
aretes_sim.ajouter(id_art1) ; |
2442 |
|
|
aretes_sim.ajouter(j2) ; |
2443 |
|
|
aretes_sim.ajouter(id_art2) ; |
2444 |
|
|
identique=-1; |
2445 |
|
|
} |
2446 |
|
|
} |
2447 |
|
|
} |
2448 |
|
|
} // aretes2 |
2449 |
|
|
|
2450 |
|
|
} //boucle2 |
2451 |
|
|
|
2452 |
|
|
// }//condition 1 //aretes_identiques |
2453 |
|
|
} |
2454 |
|
|
|
2455 |
|
|
} |
2456 |
|
|
} |
2457 |
|
|
|
2458 |
|
|
if (nb_aretes==aretes_ident.get_nb()/2) return 1; |
2459 |
|
|
else return 0; |
2460 |
|
|
|
2461 |
|
|
} |
2462 |
|
|
|
2463 |
|
|
void VCT_COMPARAISON::identifier_aretes_face_modifiee(MG_FACE* face1,MG_FACE* face2,TPL_LISTE_ENTITE<int>& aretes_identiques, |
2464 |
|
|
TPL_LISTE_ENTITE<int>&aretes_simil,TPL_LISTE_ENTITE<int>&lst_corrsp_sommets,TPL_LISTE_ENTITE<int>& aret1_conservees, |
2465 |
|
|
TPL_LISTE_ENTITE<int>& aret1_disparues,TPL_LISTE_ENTITE<int>& aret2_conservees ,TPL_LISTE_ENTITE<int>& aret2_nouvelles , |
2466 |
|
|
TPL_LISTE_ENTITE<int>& aret_partielles) |
2467 |
|
|
{ |
2468 |
|
|
|
2469 |
|
|
int nb_boucle1=face1->get_nb_mg_boucle(); |
2470 |
|
|
int nb_boucle2=face2->get_nb_mg_boucle(); |
2471 |
|
|
|
2472 |
|
|
|
2473 |
|
|
int cmpt_arete=0; |
2474 |
|
|
|
2475 |
|
|
TPL_LISTE_ENTITE<int> boucle_face1; |
2476 |
|
|
TPL_LISTE_ENTITE<int> boucle_face2; |
2477 |
|
|
|
2478 |
|
|
TPL_LISTE_ENTITE<int> aretes_ident_face1; |
2479 |
|
|
TPL_LISTE_ENTITE<int> aretes_ident_face2; |
2480 |
|
|
TPL_LISTE_ENTITE<int> aretes_face1; |
2481 |
|
|
TPL_LISTE_ENTITE<int> aretes_face2; |
2482 |
|
|
TPL_LISTE_ENTITE<int> aretes_dif_face2; |
2483 |
|
|
TPL_LISTE_ENTITE<int> aretes_sim_face1; |
2484 |
|
|
TPL_LISTE_ENTITE<int> aretes_sim_face2; |
2485 |
|
|
TPL_LISTE_ENTITE<int> lst_sommet1; |
2486 |
|
|
TPL_LISTE_ENTITE<int> lst_sommet2; |
2487 |
|
|
|
2488 |
|
|
for (int b=0;b<lst_corrsp_sommets.get_nb()/2;b++) |
2489 |
|
|
{ |
2490 |
|
|
lst_sommet1.ajouter( lst_corrsp_sommets.get(2*b)); |
2491 |
|
|
lst_sommet2.ajouter( lst_corrsp_sommets.get(2*b+1)); |
2492 |
|
|
} |
2493 |
|
|
|
2494 |
|
|
for (int b=0;b<aretes_identiques.get_nb()/4;b++) |
2495 |
|
|
{ |
2496 |
|
|
int b1= aretes_identiques.get(4*b) ; |
2497 |
|
|
int b2= aretes_identiques.get(4*b+2) ; |
2498 |
|
|
int art1= aretes_identiques.get(4*b+1); |
2499 |
|
|
int art2= aretes_identiques.get(4*b+3); |
2500 |
|
|
boucle_face1.ajouter( aretes_identiques.get(4*b)); |
2501 |
|
|
boucle_face2.ajouter( aretes_identiques.get(4*b+2)); |
2502 |
|
|
aretes_ident_face1.ajouter(aretes_identiques.get(4*b+1)); |
2503 |
|
|
aretes_ident_face2.ajouter(aretes_identiques.get(4*b+3)); |
2504 |
|
|
aret1_conservees.ajouter(art1); |
2505 |
|
|
aret2_conservees.ajouter(art2); |
2506 |
|
|
|
2507 |
|
|
} |
2508 |
|
|
|
2509 |
|
|
|
2510 |
|
|
for (int j1=0;j1<nb_boucle1;j1++) |
2511 |
|
|
{ |
2512 |
|
|
MG_BOUCLE* Boucle1 = face1->get_mg_boucle(j1); |
2513 |
|
|
int nbarete1 = Boucle1->get_nb_mg_coarete(); |
2514 |
|
|
|
2515 |
|
|
for (int w1=0; w1<nbarete1;w1++) |
2516 |
|
|
{ |
2517 |
|
|
MG_COARETE* coArete1 = Boucle1->get_mg_coarete(w1); |
2518 |
|
|
MG_ARETE* arete1 = coArete1->get_arete(); |
2519 |
|
|
int id_art1=arete1->get_id(); |
2520 |
|
|
if (!aretes_ident_face1.est_dans_la_liste(id_art1)) |
2521 |
|
|
{ |
2522 |
|
|
aret1_disparues.ajouter(id_art1); |
2523 |
|
|
} |
2524 |
|
|
} |
2525 |
|
|
} |
2526 |
|
|
|
2527 |
|
|
for (int j2=0;j2<nb_boucle2;j2++) |
2528 |
|
|
{ |
2529 |
|
|
MG_BOUCLE* Boucle2 = face2->get_mg_boucle(j2); |
2530 |
|
|
int nbarete2 = Boucle2->get_nb_mg_coarete(); |
2531 |
|
|
for (int w2=0; w2<nbarete2;w2++) |
2532 |
|
|
{ |
2533 |
|
|
MG_COARETE* coArete2 = Boucle2->get_mg_coarete(w2); |
2534 |
|
|
MG_ARETE* arete2 = coArete2->get_arete(); |
2535 |
|
|
int id_art2=arete2->get_id(); |
2536 |
|
|
if (!aretes_ident_face2.est_dans_la_liste(id_art2)) |
2537 |
|
|
{ |
2538 |
|
|
aret2_nouvelles.ajouter(id_art2); |
2539 |
|
|
} |
2540 |
|
|
|
2541 |
|
|
} |
2542 |
|
|
} |
2543 |
|
|
/* |
2544 |
|
|
for(int b=0;b<aretes_simil.get_nb()/4;b++) |
2545 |
|
|
{ |
2546 |
|
|
aretes_sim_face1.ajouter(aretes_simil.get(4*b+1)); |
2547 |
|
|
aretes_sim_face2.ajouter(aretes_simil.get(4*b+3)); |
2548 |
|
|
} |
2549 |
|
|
|
2550 |
|
|
MG_FACE* Face_ref1=mggeo1->get_mg_faceid(face_ref1) ; |
2551 |
|
|
MG_FACE* Face_ref2=mggeo2->get_mg_faceid(face_ref2) ; |
2552 |
|
|
|
2553 |
|
|
for(int j1=0;j1<nb_boucle1;j1++) |
2554 |
|
|
{ |
2555 |
|
|
MG_BOUCLE* Boucle1 = face1->get_mg_boucle(j1); |
2556 |
|
|
int nbarete1 = Boucle1->get_nb_mg_coarete(); |
2557 |
|
|
TPL_LISTE_ENTITE<int> lst_aret1_modif; |
2558 |
|
|
TPL_LISTE_ENTITE<int> lst_aret2_modif; |
2559 |
|
|
TPL_LISTE_ENTITE<int> lst_art1_partiel; |
2560 |
|
|
TPL_LISTE_ENTITE<int> lst_art2_partiel; |
2561 |
|
|
int compt1=0; |
2562 |
|
|
int boucle; |
2563 |
|
|
int start_boucle,end_boucle; |
2564 |
|
|
int cmpt=0; |
2565 |
|
|
TPL_LISTE_ENTITE<int> arete_boucle1; |
2566 |
|
|
TPL_LISTE_ENTITE<int> arete_boucle2; |
2567 |
|
|
|
2568 |
|
|
if(boucle_face1.est_dans_la_liste(j1)) |
2569 |
|
|
{ |
2570 |
|
|
for(int k=0;k<boucle_face1.get_nb();k++) |
2571 |
|
|
{ |
2572 |
|
|
if (j1==boucle_face1.get(k)) |
2573 |
|
|
{ |
2574 |
|
|
int art1=aretes_ident_face1.get(k); |
2575 |
|
|
int art2= aretes_ident_face2.get(k); |
2576 |
|
|
arete_boucle1.ajouter(aretes_ident_face1.get(k)); |
2577 |
|
|
arete_boucle2.ajouter(aretes_ident_face2.get(k)); |
2578 |
|
|
boucle=boucle_face2.get(k); |
2579 |
|
|
} |
2580 |
|
|
} |
2581 |
|
|
} |
2582 |
|
|
|
2583 |
|
|
for (int w1=0; w1<nbarete1;w1++) |
2584 |
|
|
{ |
2585 |
|
|
|
2586 |
|
|
MG_COARETE* coArete1 = Boucle1->get_mg_coarete(w1); |
2587 |
|
|
MG_ARETE* arete1 = coArete1->get_arete(); |
2588 |
|
|
int id_art=arete1->get_id(); |
2589 |
|
|
int trouv=-1; |
2590 |
|
|
for (int w1=0; w1<arete_boucle1.get_nb();w1++) |
2591 |
|
|
{ |
2592 |
|
|
int id_art1=arete_boucle1.get(w1); |
2593 |
|
|
int id_art2=arete_boucle2.get(w1); |
2594 |
|
|
|
2595 |
|
|
if(id_art1==id_art) |
2596 |
|
|
{ |
2597 |
|
|
aret1_conservees.ajouter(id_art1); |
2598 |
|
|
aret2_conservees.ajouter(id_art2); |
2599 |
|
|
trouv=1; |
2600 |
|
|
break; |
2601 |
|
|
} |
2602 |
|
|
} |
2603 |
|
|
if(trouv<0) |
2604 |
|
|
{ |
2605 |
|
|
//if(!aretes_sim_face1.est_dans_la_liste(id_art1)) |
2606 |
|
|
aret1_disparues.ajouter(id_art); |
2607 |
|
|
//lst_aret1_modif.ajouter(id_art1); |
2608 |
|
|
} |
2609 |
|
|
|
2610 |
|
|
} |
2611 |
|
|
|
2612 |
|
|
// for(int j2=0;j2<nb_boucle2;j2++) |
2613 |
|
|
// { |
2614 |
|
|
// MG_BOUCLE* Boucle2 = face2->get_mg_boucle(j2); |
2615 |
|
|
MG_BOUCLE* Boucle2 = face2->get_mg_boucle(boucle); |
2616 |
|
|
int nbarete2 = Boucle2->get_nb_mg_coarete(); |
2617 |
|
|
|
2618 |
|
|
for (int w2=0; w2<nbarete2;w2++) |
2619 |
|
|
{ |
2620 |
|
|
MG_COARETE* coArete2 = Boucle2->get_mg_coarete(w2); |
2621 |
|
|
MG_ARETE* arete2 = coArete2->get_arete(); |
2622 |
|
|
int id_art2=arete2->get_id(); |
2623 |
|
|
if(!arete_boucle2.est_dans_la_liste(id_art2)) |
2624 |
|
|
{ |
2625 |
|
|
aret2_nouvelles.ajouter(id_art2); |
2626 |
|
|
//lst_aret2_modif.ajouter(id_art2); |
2627 |
|
|
//for(int is=0;is<aretes_sim_face2.get_nb();is++) |
2628 |
|
|
//{ |
2629 |
|
|
//if(aretes_sim_face2.get(is)==id_art2) |
2630 |
|
|
// { |
2631 |
|
|
// aret2_partielles.ajouter(id_art2); |
2632 |
|
|
// } |
2633 |
|
|
// } |
2634 |
|
|
|
2635 |
|
|
} |
2636 |
|
|
// else |
2637 |
|
|
|
2638 |
|
|
// aret2_conservees.ajouter(id_art2); |
2639 |
|
|
} |
2640 |
|
|
|
2641 |
|
|
//verifier parmi les deux listes des aretes modifiees |
2642 |
|
|
//celles qui sont nouvelles ou partiellements modifees |
2643 |
|
|
/* |
2644 |
|
|
for(int m1=0;m1<lst_aret1_modif.get_nb();m1++) |
2645 |
|
|
{ |
2646 |
|
|
int id_art1=lst_aret1_modif.get(m1); |
2647 |
|
|
MG_ARETE* art1=mggeo1->get_mg_areteid(id_art1); |
2648 |
|
|
|
2649 |
|
|
OT_TENSEUR tm1_art(4),tm1_crb(4); |
2650 |
|
|
MG_COURBE* courbe1=art1->get_courbe(); |
2651 |
|
|
tm1_art=art1->get_vectorisation().calcule_tenseur_metrique(); |
2652 |
|
|
tm1_crb=courbe1->get_vectorisation().calcule_tenseur_metrique(); |
2653 |
|
|
|
2654 |
|
|
|
2655 |
|
|
MG_COSOMMET* csomt1_art1= art1->get_cosommet1(); |
2656 |
|
|
MG_COSOMMET* csomt2_art1= art1->get_cosommet2(); |
2657 |
|
|
MG_SOMMET* som1_art1= csomt1_art1->get_sommet(); |
2658 |
|
|
MG_SOMMET* som2_art1= csomt2_art1->get_sommet(); |
2659 |
|
|
int id_som11= som1_art1->get_id(); |
2660 |
|
|
int id_som21= som2_art1->get_id(); |
2661 |
|
|
int s11_ou_s21; |
2662 |
|
|
if(lst_sommet1.est_dans_la_liste(id_som11)) s11_ou_s21=1; |
2663 |
|
|
if(lst_sommet1.est_dans_la_liste(id_som21)) s11_ou_s21=2; |
2664 |
|
|
|
2665 |
|
|
if(lst_sommet1.est_dans_la_liste(id_som11)||lst_sommet1.est_dans_la_liste(id_som21)) |
2666 |
|
|
{ |
2667 |
|
|
for(int m2=0;m2<lst_aret2_modif.get_nb();m2++) |
2668 |
|
|
{ |
2669 |
|
|
int id_art2=lst_aret2_modif.get(m2); |
2670 |
|
|
MG_ARETE* art2=mggeo2->get_mg_areteid(id_art2); |
2671 |
|
|
OT_TENSEUR tm2_art(4),tm2_crb(4); |
2672 |
|
|
MG_COURBE* courbe2=art2->get_courbe(); |
2673 |
|
|
tm2_art=art1->get_vectorisation().calcule_tenseur_metrique(); |
2674 |
|
|
tm2_crb=courbe2->get_vectorisation().calcule_tenseur_metrique(); |
2675 |
|
|
|
2676 |
|
|
MG_COSOMMET* csomt1_art2= art2->get_cosommet1(); |
2677 |
|
|
MG_COSOMMET* csomt2_art2= art2->get_cosommet2(); |
2678 |
|
|
MG_SOMMET* som1_art2= csomt1_art2->get_sommet(); |
2679 |
|
|
MG_SOMMET* som2_art2= csomt2_art2->get_sommet(); |
2680 |
|
|
int id_som12= som1_art2->get_id(); |
2681 |
|
|
int id_som22= som2_art2->get_id(); |
2682 |
|
|
int s12_ou_s22; |
2683 |
|
|
if(lst_sommet2.est_dans_la_liste(id_som12)) s12_ou_s22=1; |
2684 |
|
|
if(lst_sommet2.est_dans_la_liste(id_som22)) s12_ou_s22=2; |
2685 |
|
|
|
2686 |
|
|
//if(lst_sommet2.est_dans_la_liste(id_som12)||lst_sommet2.est_dans_la_liste(id_som22)) |
2687 |
|
|
// { |
2688 |
|
|
if(tm1_art.est_til_equivalent(tm2_art)&&tm1_crb.est_til_equivalent(tm2_crb)) |
2689 |
|
|
{ |
2690 |
|
|
aret_partielles.ajouter(id_art1); |
2691 |
|
|
aret_partielles.ajouter(id_art2); |
2692 |
|
|
lst_art1_partiel.ajouter(id_art1); |
2693 |
|
|
lst_art2_partiel.ajouter(id_art2); |
2694 |
|
|
if (s11_ou_s21==1&&s12_ou_s22==1) |
2695 |
|
|
{ |
2696 |
|
|
aret_partielles.ajouter(id_som11); |
2697 |
|
|
} |
2698 |
|
|
if (s11_ou_s21==2&&s12_ou_s22==1) |
2699 |
|
|
{ |
2700 |
|
|
aret_partielles.ajouter(id_som21); |
2701 |
|
|
} |
2702 |
|
|
if (s12_ou_s22==1&&s12_ou_s22==2) |
2703 |
|
|
{ |
2704 |
|
|
aret_partielles.ajouter(id_som12); |
2705 |
|
|
} |
2706 |
|
|
if (s12_ou_s22==2&&s12_ou_s22==2) |
2707 |
|
|
{ |
2708 |
|
|
aret_partielles.ajouter(id_som22); |
2709 |
|
|
} |
2710 |
|
|
|
2711 |
|
|
} |
2712 |
|
|
// } |
2713 |
|
|
|
2714 |
|
|
} |
2715 |
|
|
} |
2716 |
|
|
} // for m1= |
2717 |
|
|
|
2718 |
|
|
|
2719 |
|
|
|
2720 |
|
|
for(int m1=0;m1<lst_aret1_modif.get_nb();m1++) |
2721 |
|
|
{ |
2722 |
|
|
int id_art1=lst_aret1_modif.get(m1); |
2723 |
|
|
if( !lst_art1_partiel.est_dans_la_liste(id_art1)) |
2724 |
|
|
aret1_disparues.ajouter(id_art1); |
2725 |
|
|
} |
2726 |
|
|
for(int m2=0;m2<lst_aret1_modif.get_nb();m2++) |
2727 |
|
|
{ |
2728 |
|
|
int id_art2=lst_aret2_modif.get(m2); |
2729 |
|
|
if( !lst_art2_partiel.est_dans_la_liste(id_art2)) |
2730 |
|
|
aret2_nouvelles.ajouter(id_art2); |
2731 |
|
|
} / |
2732 |
|
|
|
2733 |
|
|
} //boucle_face1 |
2734 |
|
|
|
2735 |
|
|
|
2736 |
|
|
for(int j2=0;j2<nb_boucle2;j2++) |
2737 |
|
|
{ |
2738 |
|
|
MG_BOUCLE* Boucle2 = face2->get_mg_boucle(j2); |
2739 |
|
|
|
2740 |
|
|
if (!boucle_face2.est_dans_la_liste(j2)) |
2741 |
|
|
{ |
2742 |
|
|
int nbarete2 = Boucle2->get_nb_mg_coarete(); |
2743 |
|
|
for (int w2=0; w2<nbarete2;w2++) |
2744 |
|
|
{ |
2745 |
|
|
MG_COARETE* coArete2 = Boucle2->get_mg_coarete(w2); |
2746 |
|
|
MG_ARETE* arete2 = coArete2->get_arete(); |
2747 |
|
|
int id_art2=arete2->get_id(); |
2748 |
|
|
aret2_nouvelles.ajouter(id_art2); |
2749 |
|
|
|
2750 |
|
|
} |
2751 |
|
|
} |
2752 |
|
|
}//boucle j2 |
2753 |
|
|
*/ |
2754 |
|
|
|
2755 |
|
|
|
2756 |
|
|
} |
2757 |
|
|
|
2758 |
|
|
|
2759 |
|
|
|
2760 |
|
|
void VCT_COMPARAISON::identifier_les_modifications_appliquees(VCT_COMPARAISON_RESULTAT& Results) |
2761 |
|
|
{ |
2762 |
|
|
|
2763 |
|
|
TPL_LISTE_ENTITE<int> face1_conservees; |
2764 |
|
|
TPL_LISTE_ENTITE<int> face2_conservees; |
2765 |
|
|
TPL_LISTE_ENTITE<int> faces_nouvelles; |
2766 |
|
|
|
2767 |
|
|
TPL_LISTE_ENTITE<int> aret_ident; |
2768 |
|
|
TPL_LISTE_ENTITE<int> aret_modif; |
2769 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
2770 |
|
|
int nb_face2=mggeo2->get_nb_mg_face(); |
2771 |
|
|
TPL_LISTE_ENTITE<int> lst_face1,lst_face2,lst_facloc1,lst_facloc2,dif1,dif2; |
2772 |
|
|
|
2773 |
|
|
|
2774 |
|
|
TPL_LISTE_ENTITE<int> faces1_partiellement_modf; |
2775 |
|
|
TPL_LISTE_ENTITE<int> faces2_partiellement_modf; |
2776 |
|
|
TPL_LISTE_ENTITE<int> Aret1_conservees; |
2777 |
|
|
TPL_LISTE_ENTITE<int> Aret1_disparues; |
2778 |
|
|
TPL_LISTE_ENTITE<int> Aret2_conservees ; |
2779 |
|
|
TPL_LISTE_ENTITE<int> Aret2_nouvelles ; |
2780 |
|
|
TPL_LISTE_ENTITE<int> Aret2_partielles ; |
2781 |
|
|
TPL_LISTE_ENTITE<int> face1_disparues; |
2782 |
|
|
for (int i=0;i<nb_face1;i++) |
2783 |
|
|
{ |
2784 |
|
|
OT_VECTEUR_4DD g1,G1; |
2785 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
2786 |
|
|
int id1=face1->get_id(); |
2787 |
|
|
lst_face1.ajouter(id1); |
2788 |
|
|
} |
2789 |
|
|
|
2790 |
|
|
for (int i=0;i<nb_face2;i++) |
2791 |
|
|
{ |
2792 |
|
|
OT_VECTEUR_4DD g1,G1; |
2793 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(i); |
2794 |
|
|
int id2=face2->get_id(); |
2795 |
|
|
lst_face2.ajouter(id2); |
2796 |
|
|
} |
2797 |
|
|
|
2798 |
|
|
|
2799 |
|
|
|
2800 |
|
|
MG_FACE* Face_ref1=mggeo1->get_mg_faceid(face_ref1) ; |
2801 |
|
|
MG_FACE* Face_ref2=mggeo2->get_mg_faceid(face_ref2) ; |
2802 |
|
|
int nb_faces_identique=identite.get_nb()/2; |
2803 |
|
|
for (int i=0;i<nb_faces_identique;i++) |
2804 |
|
|
{ |
2805 |
|
|
CORRESPONDANCE CORRESP; |
2806 |
|
|
int face1_id=identite.get(2*i); |
2807 |
|
|
int face2_id=identite.get(2*i+1); |
2808 |
|
|
MG_FACE* Face1=mggeo1->get_mg_faceid(face1_id); |
2809 |
|
|
MG_FACE* Face2=mggeo2->get_mg_faceid(face2_id); |
2810 |
|
|
face1_conservees.ajouter(face1_id); |
2811 |
|
|
face2_conservees.ajouter(face2_id); |
2812 |
|
|
Results.ajouter_liste_topologie(ORIGINE_CONSERVEE,Face1); |
2813 |
|
|
Results.ajouter_liste_topologie(MODIFIE_CONSERVEE,Face2); |
2814 |
|
|
CORRESP.eleorigine=Face1; |
2815 |
|
|
CORRESP.elemodifie=Face2; |
2816 |
|
|
Results.ajouter_liste_topologie(CORRESP); |
2817 |
|
|
|
2818 |
|
|
//---------------------------------------- |
2819 |
|
|
TPL_LISTE_ENTITE<int> aretes_identiques; |
2820 |
|
|
TPL_LISTE_ENTITE<int> aretes_similaires; |
2821 |
|
|
|
2822 |
|
|
//------------------------------------------ |
2823 |
|
|
this->comparer_aretes_faces(Face_ref1,Face_ref2,Face1,Face2,aretes_identiques,aretes_similaires); |
2824 |
|
|
|
2825 |
|
|
int nb_aretes_trouvees=aretes_identiques.get_nb()/4; |
2826 |
|
|
|
2827 |
|
|
if (nb_aretes_trouvees) |
2828 |
|
|
{ |
2829 |
|
|
CORRESPONDANCE corsp; |
2830 |
|
|
for (int i1=0;i1<nb_aretes_trouvees;i1++) |
2831 |
|
|
{ |
2832 |
|
|
int art1_id=aretes_identiques.get(4*i1+1); |
2833 |
|
|
MG_ARETE*art1_cons=mggeo1->get_mg_areteid(art1_id); |
2834 |
|
|
Results.ajouter_liste_topologie(ORIGINE_CONSERVEE,art1_cons); |
2835 |
|
|
int art2_id=aretes_identiques.get(4*i1+3); |
2836 |
|
|
MG_ARETE*art2_cons=mggeo2->get_mg_areteid(art2_id); |
2837 |
|
|
Results.ajouter_liste_topologie(MODIFIE_CONSERVEE,art2_cons); |
2838 |
|
|
|
2839 |
|
|
corsp.eleorigine=art1_cons; |
2840 |
|
|
corsp.elemodifie=art2_cons; |
2841 |
|
|
Results.ajouter_liste_topologie(corsp); |
2842 |
|
|
} |
2843 |
|
|
} |
2844 |
|
|
|
2845 |
|
|
|
2846 |
|
|
} |
2847 |
|
|
|
2848 |
|
|
TPL_LISTE_ENTITE<int> lst_corrsp_sommets; |
2849 |
|
|
this->identifier_les_sommets(Face_ref1,Face_ref2,lst_corrsp_sommets,Results); |
2850 |
|
|
|
2851 |
|
|
|
2852 |
|
|
for (int t=0;t<lst_face1.get_nb();t++) |
2853 |
|
|
{ |
2854 |
|
|
if (!face1_conservees.est_dans_la_liste(lst_face1.get(t)) ) |
2855 |
|
|
dif1.ajouter(lst_face1.get(t)); |
2856 |
|
|
} |
2857 |
|
|
for (int it=0;it<lst_face2.get_nb();it++) |
2858 |
|
|
{ |
2859 |
|
|
if (!face2_conservees.est_dans_la_liste(lst_face2.get(it))) |
2860 |
|
|
dif2.ajouter(lst_face2.get(it)); |
2861 |
|
|
} |
2862 |
|
|
|
2863 |
|
|
|
2864 |
|
|
for (int i=0;i<dif1.get_nb();i++) |
2865 |
|
|
{ |
2866 |
|
|
int Num1=dif1.get(i); |
2867 |
|
|
MG_FACE* face1=mggeo1->get_mg_faceid(Num1); |
2868 |
|
|
MG_SURFACE* surf1=face1->get_surface(); |
2869 |
|
|
OT_VECTEUR_4DD G1=face1->get_vectorisation().calcule_barycentre(T1); |
2870 |
|
|
G1=surf1->get_vectorisation().get_nouveau_pt(T1,G1); |
2871 |
|
|
for (int j=0;j<dif2.get_nb();j++) |
2872 |
|
|
{ |
2873 |
|
|
int Num2=dif2.get(j); |
2874 |
|
|
TPL_LISTE_ENTITE<int> aretes_identiques; |
2875 |
|
|
TPL_LISTE_ENTITE<int> aretes_similaires; |
2876 |
|
|
TPL_LISTE_ENTITE<int> aretes_conservees; |
2877 |
|
|
TPL_LISTE_ENTITE<int> nouvelles_aretes ; |
2878 |
|
|
TPL_LISTE_ENTITE<int> aret1_conservees; |
2879 |
|
|
TPL_LISTE_ENTITE<int> aret1_disparues; |
2880 |
|
|
TPL_LISTE_ENTITE<int> aret2_conservees ; |
2881 |
|
|
TPL_LISTE_ENTITE<int> aret2_nouvelles ; |
2882 |
|
|
TPL_LISTE_ENTITE<int> aret2_partielles ; |
2883 |
|
|
|
2884 |
|
|
MG_FACE* face2=mggeo2->get_mg_faceid(Num2); |
2885 |
|
|
MG_SURFACE* surf2=face2->get_surface(); |
2886 |
|
|
OT_VECTEUR_4DD G2=face2->get_vectorisation().calcule_barycentre(T2); |
2887 |
|
|
// if(!faces1_partiellement_modf.est_dans_la_liste(Num1)) |
2888 |
|
|
// { |
2889 |
|
|
|
2890 |
|
|
if (surfaces_sont_elles_identiques(face1,face2)) //G1==G2 |
2891 |
|
|
{ |
2892 |
|
|
comparer_aretes_faces(Face_ref1,Face_ref2,face1,face2,aretes_identiques,aretes_similaires); |
2893 |
|
|
int nb_aretes_trouvees=aretes_identiques.get_nb()/2; |
2894 |
|
|
if (nb_aretes_trouvees) |
2895 |
|
|
identifier_aretes_face_modifiee(face1,face2,aretes_identiques,aretes_similaires,lst_corrsp_sommets,aret1_conservees,aret1_disparues,aret2_conservees ,aret2_nouvelles ,aret2_partielles); |
2896 |
|
|
int id_face2=face2->get_id(); |
2897 |
|
|
|
2898 |
|
|
if (nb_aretes_trouvees) |
2899 |
|
|
{ |
2900 |
|
|
// if (!face2_conservees.est_dans_la_liste(Num2)) |
2901 |
|
|
// { |
2902 |
|
|
CORRESPONDANCE CORRESP_FACE; |
2903 |
|
|
Results.ajouter_liste_topologie(ORIGINE_CONSERVEE,face1); |
2904 |
|
|
Results.ajouter_liste_topologie(MODIFIE_CONSERVEE,face2); |
2905 |
|
|
CORRESP_FACE.eleorigine=face1; |
2906 |
|
|
CORRESP_FACE.elemodifie=face2; |
2907 |
|
|
Results.ajouter_liste_topologie(CORRESP_FACE); |
2908 |
|
|
face1_conservees.ajouter(Num1); |
2909 |
|
|
face2_conservees.ajouter(Num2); |
2910 |
|
|
|
2911 |
|
|
for (int i1=0;i1<aret1_conservees.get_nb();i1++) |
2912 |
|
|
{ |
2913 |
|
|
int art1_id=aret1_conservees.get(i1); |
2914 |
|
|
Aret1_conservees.ajouter(art1_id); |
2915 |
|
|
MG_ARETE*art1_cons=mggeo1->get_mg_areteid(art1_id); |
2916 |
|
|
Results.ajouter_liste_topologie(ORIGINE_CONSERVEE,art1_cons); |
2917 |
|
|
int art2_id= aret2_conservees.get(i1) ; |
2918 |
|
|
Aret2_conservees.ajouter(art2_id); |
2919 |
|
|
MG_ARETE*art2_cons=mggeo2->get_mg_areteid(art2_id); |
2920 |
|
|
Results.ajouter_liste_topologie(MODIFIE_CONSERVEE,art2_cons); |
2921 |
|
|
CORRESPONDANCE CORRESP; |
2922 |
|
|
CORRESP.eleorigine=art1_cons; |
2923 |
|
|
CORRESP.elemodifie=art2_cons; |
2924 |
|
|
Results.ajouter_liste_topologie(CORRESP); |
2925 |
|
|
} |
2926 |
|
|
|
2927 |
|
|
for (int i1=0;i1<aret1_disparues.get_nb();i1++) |
2928 |
|
|
{ |
2929 |
|
|
int art_dsp=aret1_disparues.get(i1) ; |
2930 |
|
|
Aret1_disparues.ajouter(art_dsp); |
2931 |
|
|
//MG_ARETE*art_disp=mggeo1->get_mg_areteid(art_dsp); |
2932 |
|
|
//Results.ajouter_liste_topologie(ORIGINE_DISPARUE,art_disp); |
2933 |
|
|
} |
2934 |
|
|
|
2935 |
|
|
for (int i1=0;i1<aret2_nouvelles.get_nb();i1++) |
2936 |
|
|
{ |
2937 |
|
|
int art_nv= aret2_nouvelles.get(i1) ; |
2938 |
|
|
Aret2_nouvelles.ajouter(art_nv); |
2939 |
|
|
//MG_ARETE*art_app=mggeo2->get_mg_areteid(art_nv); |
2940 |
|
|
//Results.ajouter_liste_topologie(MODIFIE_APPARUE,art_app); |
2941 |
|
|
} |
2942 |
|
|
//for(int i1=0;i1<aret2_partielles.get_nb()/2;i1++){ |
2943 |
|
|
// int art1_prt=aret2_partielles.get(2*i1); |
2944 |
|
|
// int art2_prt=aret2_partielles.get(2*i1+1); |
2945 |
|
|
|
2946 |
|
|
//il faut metttre les points des sous artes avec leurs correspondances; |
2947 |
|
|
|
2948 |
|
|
//Results.ajouter_liste_topologie(MODIFIE_APPARUE,art_app); |
2949 |
|
|
|
2950 |
|
|
// Aret2_partielles.ajouter(art1_prt); |
2951 |
|
|
// } |
2952 |
|
|
faces1_partiellement_modf.ajouter(Num1); |
2953 |
|
|
faces2_partiellement_modf.ajouter(Num2); |
2954 |
|
|
// }//verid |
2955 |
|
|
}// if()nb_aretes_trouvees |
2956 |
|
|
|
2957 |
|
|
} //if (G1==G2) |
2958 |
|
|
// } |
2959 |
|
|
} |
2960 |
|
|
} |
2961 |
|
|
|
2962 |
|
|
|
2963 |
|
|
|
2964 |
|
|
|
2965 |
|
|
|
2966 |
|
|
for (int i=0;i<Aret2_nouvelles.get_nb();i++) |
2967 |
|
|
{ |
2968 |
|
|
int art_nouv=Aret2_nouvelles.get(i); |
2969 |
|
|
if (! Aret2_conservees.est_dans_la_liste(Aret2_nouvelles.get(i))) |
2970 |
|
|
{ |
2971 |
|
|
MG_ARETE*art_app=mggeo2->get_mg_areteid(art_nouv); |
2972 |
|
|
Results.ajouter_liste_topologie(MODIFIE_APPARUE,art_app); |
2973 |
|
|
} |
2974 |
|
|
} |
2975 |
|
|
|
2976 |
|
|
for (int i=0;i<Aret1_disparues.get_nb();i++) |
2977 |
|
|
{ |
2978 |
|
|
int art_nouv=Aret1_disparues.get(i); |
2979 |
|
|
if (! Aret1_conservees.est_dans_la_liste(Aret1_disparues.get(i))) |
2980 |
|
|
{ |
2981 |
|
|
MG_ARETE*art_disp=mggeo1->get_mg_areteid(art_nouv); |
2982 |
|
|
Results.ajouter_liste_topologie(ORIGINE_DISPARUE,art_disp); |
2983 |
|
|
} |
2984 |
|
|
} |
2985 |
|
|
|
2986 |
|
|
|
2987 |
|
|
for (int j=0;j<dif2.get_nb();j++) |
2988 |
|
|
{ |
2989 |
|
|
if (!face2_conservees.est_dans_la_liste(dif2.get(j))) |
2990 |
|
|
{ |
2991 |
|
|
int nouv_face=dif2.get(j); |
2992 |
|
|
faces_nouvelles.ajouter(nouv_face); |
2993 |
|
|
MG_FACE* Face_Nouvelle=mggeo2->get_mg_faceid(nouv_face); |
2994 |
|
|
Results.ajouter_liste_topologie(MODIFIE_APPARUE,Face_Nouvelle); |
2995 |
|
|
int nb_boucle2=Face_Nouvelle->get_nb_mg_boucle(); |
2996 |
|
|
|
2997 |
|
|
for (int j=0;j<nb_boucle2;j++) |
2998 |
|
|
{ |
2999 |
|
|
MG_BOUCLE* Boucle2 = Face_Nouvelle->get_mg_boucle(j); |
3000 |
|
|
int nbarete2 = Boucle2->get_nb_mg_coarete(); |
3001 |
|
|
for (int w2=0;w2<nbarete2;w2++) |
3002 |
|
|
{ |
3003 |
|
|
MG_COARETE* coArete2 = Boucle2->get_mg_coarete(w2); |
3004 |
|
|
MG_ARETE* arete_nouvelle = coArete2->get_arete(); |
3005 |
|
|
Results.ajouter_liste_topologie(MODIFIE_APPARUE,arete_nouvelle); |
3006 |
|
|
MG_COSOMMET* cosommt1= arete_nouvelle->get_cosommet1(); |
3007 |
|
|
MG_COSOMMET* cosommt2= arete_nouvelle->get_cosommet2(); |
3008 |
|
|
MG_SOMMET* nouveau_sommet1= cosommt1->get_sommet(); |
3009 |
|
|
MG_SOMMET* nouveau_sommet2= cosommt2->get_sommet(); |
3010 |
|
|
Results.ajouter_liste_topologie(MODIFIE_APPARUE,nouveau_sommet1); |
3011 |
|
|
Results.ajouter_liste_topologie(MODIFIE_APPARUE,nouveau_sommet2); |
3012 |
|
|
} |
3013 |
|
|
} |
3014 |
|
|
} |
3015 |
|
|
} |
3016 |
|
|
|
3017 |
|
|
for (int i1=0;i1<nb_face1;i1++) |
3018 |
|
|
{ |
3019 |
|
|
MG_FACE*face1=mggeo1->get_mg_face(i1); |
3020 |
|
|
int face1_id=face1->get_id(); |
3021 |
|
|
if (!face1_conservees.est_dans_la_liste(face1_id)) |
3022 |
|
|
{ |
3023 |
|
|
Results.ajouter_liste_topologie(ORIGINE_DISPARUE,face1); |
3024 |
|
|
int nb_boucle1=face1->get_nb_mg_boucle(); |
3025 |
|
|
for (int j1=0;j1<nb_boucle1;j1++) |
3026 |
|
|
{ |
3027 |
|
|
MG_BOUCLE* Boucle1 = face1->get_mg_boucle(j1); |
3028 |
|
|
int nbarete1 = Boucle1->get_nb_mg_coarete(); |
3029 |
|
|
for (int w1 =0; w1<nbarete1;w1++) |
3030 |
|
|
{ |
3031 |
|
|
MG_COARETE* coArete1 = Boucle1->get_mg_coarete(w1); |
3032 |
|
|
MG_ARETE* arete1 = coArete1->get_arete(); |
3033 |
|
|
int id_art1=arete1->get_id(); |
3034 |
|
|
Results.ajouter_liste_topologie(ORIGINE_DISPARUE,arete1); |
3035 |
|
|
|
3036 |
|
|
} |
3037 |
|
|
} |
3038 |
|
|
} |
3039 |
|
|
} |
3040 |
|
|
|
3041 |
|
|
for (int i=0;i<nb_face1;i++) |
3042 |
|
|
{ |
3043 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
3044 |
|
|
MG_SURFACE* surf1=face1->get_surface(); |
3045 |
|
|
int id1=face1->get_id(); |
3046 |
|
|
if (!face1_conservees.est_dans_la_liste(id1)) |
3047 |
|
|
{ |
3048 |
|
|
OT_TENSEUR tns1_surf(4),tns2_surf(4); |
3049 |
|
|
tns1_surf=surf1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
3050 |
|
|
vector<double2> isurf1; |
3051 |
|
|
for (int r=0;r<4;r++) |
3052 |
|
|
{ |
3053 |
|
|
isurf1.insert( isurf1.end(), tns1_surf(r,r)); |
3054 |
|
|
} |
3055 |
|
|
for (int j=0;j<nb_face2;j++) |
3056 |
|
|
{ |
3057 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
3058 |
|
|
MG_SURFACE* surf2=face2->get_surface(); |
3059 |
|
|
int id2=face2->get_id(); |
3060 |
|
|
CORRESPONDANCE CORRESP_FACE; |
3061 |
|
|
OT_VECTEUR_4DD G1=surf1->get_vectorisation().calcule_barycentre(T1); |
3062 |
|
|
OT_VECTEUR_4DD G2=surf2->get_vectorisation().calcule_barycentre(T2); |
3063 |
|
|
G1=surf1->get_vectorisation().get_nouveau_pt(T1,G1); |
3064 |
|
|
tns2_surf=surf2->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
3065 |
|
|
vector<double2> isurf2; |
3066 |
|
|
for (int r=0;r<4;r++) |
3067 |
|
|
{ |
3068 |
|
|
isurf2.insert( isurf2.end(), tns1_surf(r,r)); |
3069 |
|
|
} |
3070 |
|
|
vector<unsigned int> indx1; |
3071 |
|
|
if (tns1_surf.listes_equivalentes(isurf1,isurf2,indx1)) |
3072 |
|
|
{ |
3073 |
|
|
if (G1==G2) |
3074 |
|
|
{ |
3075 |
|
|
Results.ajouter_liste_topologie(ORIGINE_CONSERVEE,face1); |
3076 |
|
|
Results.ajouter_liste_topologie(MODIFIE_CONSERVEE,face2); |
3077 |
|
|
CORRESP_FACE.eleorigine=face1; |
3078 |
|
|
CORRESP_FACE.elemodifie=face2; |
3079 |
|
|
Results.ajouter_liste_topologie(CORRESP_FACE); |
3080 |
|
|
|
3081 |
|
|
} |
3082 |
|
|
} |
3083 |
|
|
} |
3084 |
|
|
} |
3085 |
|
|
} |
3086 |
|
|
|
3087 |
|
|
identite.vide(); |
3088 |
|
|
for (int i=0;i<face1_conservees.get_nb();i++) |
3089 |
|
|
{ |
3090 |
|
|
identite.ajouter( face1_conservees.get(i)); |
3091 |
|
|
identite.ajouter( face2_conservees.get(i)); |
3092 |
|
|
} |
3093 |
|
|
this->affecter_les_couleurs(1); |
3094 |
|
|
|
3095 |
|
|
} |
3096 |
|
|
|
3097 |
|
|
int VCT_COMPARAISON::surfaces_sont_elles_identiques(MG_FACE* face1,MG_FACE* face2) |
3098 |
|
|
{ |
3099 |
|
|
MG_SURFACE* surf1=face1->get_surface(); |
3100 |
|
|
MG_SURFACE* surf2=face2->get_surface(); |
3101 |
|
|
vector<double2> isurf1,isurf2; |
3102 |
|
|
vector<unsigned int> indx1; |
3103 |
|
|
TPL_LISTE_ENTITE<double> parm1,parm2; |
3104 |
|
|
OT_VECTEUR_4DD Dv1,Dv2,axe3; |
3105 |
|
|
OT_VECTEUR_4DD VNUL(0.,0.,0.,0.); |
3106 |
|
|
double2 ZER=0.; |
3107 |
|
|
OT_TENSEUR tm1_surf(4),tm2_surf(4),tns1_surf(4),tns2_surf(4),V1(4),V2(4); |
3108 |
|
|
OT_VECTEUR_4DD G1=surf1->get_vectorisation().calcule_barycentre(T1); |
3109 |
|
|
G1=surf1->get_vectorisation().get_nouveau_pt(T1,G1); |
3110 |
|
|
tns1_surf=surf1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
3111 |
|
|
OT_VECTEUR_4DD G2=surf2->get_vectorisation().calcule_barycentre(T2); |
3112 |
|
|
tns2_surf=surf2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
3113 |
|
|
tm1_surf=surf1->get_vectorisation().calcule_tenseur_metrique(); |
3114 |
|
|
tm2_surf=surf2->get_vectorisation().calcule_tenseur_metrique(); |
3115 |
|
|
|
3116 |
|
|
surf1->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
3117 |
|
|
surf2->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
3118 |
|
|
|
3119 |
|
|
for (int r=0;r<4;r++) |
3120 |
|
|
{ |
3121 |
|
|
isurf1.insert( isurf1.end(), tns1_surf(r,r)); |
3122 |
|
|
isurf2.insert( isurf2.end(), tns2_surf(r,r)); |
3123 |
|
|
} |
3124 |
|
|
|
3125 |
|
|
if (surf2->get_type_geometrique(parm2)==MGCo_PLAN) |
3126 |
|
|
{ |
3127 |
|
|
axe3[0]= parm2.get(3); |
3128 |
|
|
axe3[1]= parm2.get(4); |
3129 |
|
|
axe3[2]= parm2.get(5); |
3130 |
|
|
axe3[3]= 0; |
3131 |
|
|
G1=face1->get_vectorisation().calcule_barycentre(T1); |
3132 |
|
|
G2=face2->get_vectorisation().calcule_barycentre(T2); |
3133 |
|
|
|
3134 |
|
|
} |
3135 |
|
|
if (surf2->get_type_geometrique(parm1)==MGCo_CYLINDRE||surf2->get_type_geometrique(parm2)==MGCo_CONE) |
3136 |
|
|
{ |
3137 |
|
|
axe3[0]= parm2.get(3); |
3138 |
|
|
axe3[1]= parm2.get(4); |
3139 |
|
|
axe3[2]= parm2.get(5); |
3140 |
|
|
axe3[3]= 0; |
3141 |
|
|
} |
3142 |
|
|
//axe3=surf1->get_vectorisation().get_nouveau_pt(T1,axe3); |
3143 |
|
|
double2 d1=axe3[0]*G1[0]+axe3[1]*G1[1]+axe3[2]*G1[3]; |
3144 |
|
|
double2 d2=axe3[0]*G2[0]+axe3[1]*G2[1]+axe3[2]*G2[3]; |
3145 |
|
|
|
3146 |
|
|
if (tm1_surf.est_til_equivalent(tm2_surf)) |
3147 |
|
|
{ |
3148 |
|
|
if (tns1_surf.listes_equivalentes(isurf1,isurf2,indx1)) |
3149 |
|
|
{ |
3150 |
|
|
OT_VECTEUR_4DD G1G2= G1-G2; |
3151 |
|
|
double2 mm=G1G2*axe3; |
3152 |
|
|
if (ZER==mm) |
3153 |
|
|
{ |
3154 |
|
|
return 1; |
3155 |
|
|
} |
3156 |
|
|
} |
3157 |
|
|
} |
3158 |
|
|
return 0; |
3159 |
|
|
} |
3160 |
|
|
|
3161 |
|
|
|
3162 |
|
|
int VCT_COMPARAISON::courbes_sont_elles_identiques(MG_ARETE* arete1,MG_ARETE* arete2) |
3163 |
|
|
{ |
3164 |
|
|
MG_COURBE* courb1=arete1->get_courbe(); |
3165 |
|
|
MG_COURBE* courb2=arete2->get_courbe(); |
3166 |
|
|
vector<double2> icourb1,icourb2; |
3167 |
|
|
vector<unsigned int> indx1; |
3168 |
|
|
TPL_LISTE_ENTITE<double> parm1,parm2; |
3169 |
|
|
OT_VECTEUR_4DD Dv1,Dv2,axe3; |
3170 |
|
|
OT_VECTEUR_4DD VNUL(0.,0.,0.,0.); |
3171 |
|
|
double2 ZER=0.; |
3172 |
|
|
OT_TENSEUR tm1_surf(4),tm2_surf(4),tns1_surf(4),tns2_surf(4),V1(4),V2(4); |
3173 |
|
|
OT_VECTEUR_4DD G1=courb1->get_vectorisation().calcule_barycentre(T1); |
3174 |
|
|
G1=courb1->get_vectorisation().get_nouveau_pt(T1,G1); |
3175 |
|
|
tns1_surf=courb1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
3176 |
|
|
OT_VECTEUR_4DD G2=courb2->get_vectorisation().calcule_barycentre(T2); |
3177 |
|
|
tns2_surf=courb2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
3178 |
|
|
tm1_surf=courb1->get_vectorisation().calcule_tenseur_metrique(); |
3179 |
|
|
tm2_surf=courb2->get_vectorisation().calcule_tenseur_metrique(); |
3180 |
|
|
|
3181 |
|
|
courb1->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
3182 |
|
|
courb2->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
3183 |
|
|
|
3184 |
|
|
for (int r=0;r<4;r++) |
3185 |
|
|
{ |
3186 |
|
|
icourb1.insert( icourb1.end(), tns1_surf(r,r)); |
3187 |
|
|
icourb2.insert( icourb2.end(), tns2_surf(r,r)); |
3188 |
|
|
} |
3189 |
|
|
|
3190 |
|
|
if (courb2->get_type_geometrique(parm2)==MGCo_LINE) |
3191 |
|
|
{ |
3192 |
|
|
axe3[0]= parm2.get(3); |
3193 |
|
|
axe3[1]= parm2.get(4); |
3194 |
|
|
axe3[2]= parm2.get(5); |
3195 |
|
|
axe3[3]= 0; |
3196 |
|
|
G1=arete1->get_vectorisation().calcule_barycentre(T1); |
3197 |
|
|
G2=arete2->get_vectorisation().calcule_barycentre(T2); |
3198 |
|
|
|
3199 |
|
|
} |
3200 |
|
|
if (courb2->get_type_geometrique(parm1)==MGCo_CIRCLE||courb2->get_type_geometrique(parm2)==MGCo_ELLIPSE) |
3201 |
|
|
{ |
3202 |
|
|
axe3[0]= parm2.get(3); |
3203 |
|
|
axe3[1]= parm2.get(4); |
3204 |
|
|
axe3[2]= parm2.get(5); |
3205 |
|
|
axe3[3]= 0; |
3206 |
|
|
} |
3207 |
|
|
|
3208 |
|
|
if (tm1_surf.est_til_equivalent(tm2_surf)) |
3209 |
|
|
{ |
3210 |
|
|
if (tns1_surf.listes_equivalentes(icourb1,icourb2,indx1)) |
3211 |
|
|
{ |
3212 |
|
|
OT_VECTEUR_4DD G1G2= G1-G2; |
3213 |
|
|
OT_VECTEUR_4DD mm=G1G2^axe3; |
3214 |
|
|
if (VNUL==mm) |
3215 |
|
|
{ |
3216 |
|
|
return 1; |
3217 |
|
|
} |
3218 |
|
|
} |
3219 |
|
|
} |
3220 |
|
|
return 0; |
3221 |
|
|
|
3222 |
|
|
|
3223 |
|
|
|
3224 |
|
|
|
3225 |
|
|
} |
3226 |
|
|
|
3227 |
|
|
|
3228 |
|
|
|
3229 |
|
|
|
3230 |
|
|
|
3231 |
|
|
|
3232 |
|
|
void VCT_COMPARAISON::identifier_les_sommets(MG_FACE* face1_ref,MG_FACE* face2_ref,TPL_LISTE_ENTITE<int>& lst_corrsp_sommets,VCT_COMPARAISON_RESULTAT& Results) |
3233 |
|
|
{ |
3234 |
|
|
|
3235 |
|
|
OT_VECTEUR_4DD Dv1,Dv2,G1,gf1,gf2,G2; |
3236 |
|
|
OT_TENSEUR V1(4),V2(4); |
3237 |
|
|
TPL_LISTE_ENTITE<int> lst1_som_trouve; |
3238 |
|
|
TPL_LISTE_ENTITE<int> lst2_som_trouve; |
3239 |
|
|
face1_ref->get_vectorisation().calcule_axes_dinertie(T1,Dv1,V1); |
3240 |
|
|
G1=face1_ref->get_vectorisation().calcule_barycentre(T1); |
3241 |
|
|
|
3242 |
|
|
/* |
3243 |
|
|
for(int r=0;r<4;r++) { |
3244 |
|
|
for(int s=0;s<4;s++) { |
3245 |
|
|
gf1[r]= gf1[r]+V1(s,r)*G1[s]; |
3246 |
|
|
} |
3247 |
|
|
} */ |
3248 |
|
|
|
3249 |
|
|
face2_ref->get_vectorisation().calcule_axes_dinertie(T2,Dv2,V2); |
3250 |
|
|
G2=face2_ref->get_vectorisation().calcule_barycentre(T2); |
3251 |
|
|
/* |
3252 |
|
|
for(int r=0;r<4;r++) { |
3253 |
|
|
for(int s=0;s<4;s++) { |
3254 |
|
|
gf2[r]= gf2[r]+V2(s,r)*G2[s]; |
3255 |
|
|
} |
3256 |
|
|
} */ |
3257 |
|
|
|
3258 |
|
|
int nb_sommet1= mggeo1->get_nb_mg_sommet(); |
3259 |
|
|
int nb_sommet2= mggeo2->get_nb_mg_sommet(); |
3260 |
|
|
|
3261 |
|
|
|
3262 |
|
|
|
3263 |
|
|
for (int i=0;i<nb_sommet1;i++) |
3264 |
|
|
{ |
3265 |
|
|
double xyz1[3]; |
3266 |
|
|
OT_VECTEUR_4DD S1,s1, G1G1REF; |
3267 |
|
|
MG_SOMMET *som1=mggeo1->get_mg_sommet(i); |
3268 |
|
|
MG_POINT* pt1=som1->get_point(); |
3269 |
|
|
int som1_id=som1->get_id(); |
3270 |
|
|
pt1->evaluer(xyz1); |
3271 |
|
|
for (int t=0;t<3;t++) s1[t]=xyz1[t]; |
3272 |
|
|
G1G1REF=s1-G1; |
3273 |
|
|
G1G1REF=face1_ref->get_vectorisation().get_nouveau_pt(T1,G1G1REF); |
3274 |
|
|
/* |
3275 |
|
|
for(int r=0;r<4;r++) { |
3276 |
|
|
for(int s=0;s<4;s++) { |
3277 |
|
|
S1[r]= S1[r]+V1(s,r)*s1[s]; |
3278 |
|
|
} |
3279 |
|
|
} */ |
3280 |
|
|
|
3281 |
|
|
|
3282 |
|
|
for (int j=0;j<nb_sommet2;j++) |
3283 |
|
|
{ |
3284 |
|
|
double xyz2[3]; |
3285 |
|
|
OT_VECTEUR_4DD S2,s2,G2G2REF; |
3286 |
|
|
MG_SOMMET *som2=mggeo2->get_mg_sommet(j); |
3287 |
|
|
MG_POINT* pt2=som2->get_point(); |
3288 |
|
|
int som2_id=som2->get_id(); |
3289 |
|
|
if ( lst1_som_trouve.est_dans_la_liste(som1_id)) break; |
3290 |
|
|
|
3291 |
|
|
pt2->evaluer(xyz2); |
3292 |
|
|
for (int t=0;t<3;t++) s2[t]=xyz2[t]; |
3293 |
|
|
G2G2REF=s2-G2; |
3294 |
|
|
/* |
3295 |
|
|
for(int r=0;r<4;r++) { |
3296 |
|
|
for(int s=0;s<4;s++) { |
3297 |
|
|
S2[r]= S2[r]+V2(s,r)*s2[s]; |
3298 |
|
|
} |
3299 |
|
|
} */ |
3300 |
|
|
|
3301 |
|
|
if (G1G1REF==G2G2REF) |
3302 |
|
|
{ |
3303 |
|
|
Results.ajouter_liste_topologie(ORIGINE_CONSERVEE,som1); |
3304 |
|
|
Results.ajouter_liste_topologie(MODIFIE_CONSERVEE,som2); |
3305 |
|
|
CORRESPONDANCE CORRESP; |
3306 |
|
|
CORRESP.eleorigine=som1; |
3307 |
|
|
CORRESP.elemodifie=som2; |
3308 |
|
|
Results.ajouter_liste_topologie(CORRESP); |
3309 |
|
|
lst_corrsp_sommets.ajouter(som1_id); |
3310 |
|
|
lst_corrsp_sommets.ajouter(som2_id); |
3311 |
|
|
lst1_som_trouve.ajouter(som1_id); |
3312 |
|
|
lst2_som_trouve.ajouter(som2_id); |
3313 |
|
|
} |
3314 |
|
|
|
3315 |
|
|
} |
3316 |
|
|
|
3317 |
|
|
|
3318 |
|
|
|
3319 |
|
|
} |
3320 |
|
|
|
3321 |
|
|
|
3322 |
|
|
for (int i=0;i<nb_sommet1;i++) |
3323 |
|
|
{ |
3324 |
|
|
MG_SOMMET *som=mggeo1->get_mg_sommet(i); |
3325 |
|
|
int som_id=som->get_id(); |
3326 |
|
|
if (! lst1_som_trouve.est_dans_la_liste(som_id)) |
3327 |
|
|
{ |
3328 |
|
|
|
3329 |
|
|
Results.ajouter_liste_topologie(ORIGINE_DISPARUE,som); |
3330 |
|
|
|
3331 |
|
|
} |
3332 |
|
|
|
3333 |
|
|
} |
3334 |
|
|
|
3335 |
|
|
for (int i=0;i<nb_sommet2;i++) |
3336 |
|
|
{ |
3337 |
|
|
MG_SOMMET *som=mggeo2->get_mg_sommet(i); |
3338 |
|
|
int som_id=som->get_id(); |
3339 |
|
|
if (! lst2_som_trouve.est_dans_la_liste(som_id)) |
3340 |
|
|
{ |
3341 |
|
|
|
3342 |
|
|
Results.ajouter_liste_topologie(MODIFIE_APPARUE,som); |
3343 |
|
|
|
3344 |
|
|
} |
3345 |
|
|
|
3346 |
|
|
} |
3347 |
|
|
|
3348 |
|
|
} |
3349 |
|
|
|
3350 |
|
|
|
3351 |
|
|
|
3352 |
|
|
|
3353 |
|
|
|
3354 |
|
|
void VCT_COMPARAISON::get_syteme_daxes_globale() |
3355 |
|
|
{ |
3356 |
|
|
|
3357 |
|
|
OT_VECTEUR_4DD Dv1,Dv2,Dw,G1,G2,G1G2; |
3358 |
|
|
OT_TENSEUR p(4),q(4),pT,qT; |
3359 |
|
|
int nb_face1=mggeo1->get_nb_mg_face(); |
3360 |
|
|
int nb_face2=mggeo1->get_nb_mg_face(); |
3361 |
|
|
OT_VECTEUR_4DD VNul(0.,0.,0.,0.); |
3362 |
|
|
double2 cof=-1; |
3363 |
|
|
int plan=-1; |
3364 |
|
|
for (int i=3;i<nb_face1;i++) |
3365 |
|
|
{ |
3366 |
|
|
OT_TENSEUR inertie_face1(4); |
3367 |
|
|
vector<double2> iface1; |
3368 |
|
|
MG_FACE* face1=mggeo1->get_mg_face(i); |
3369 |
|
|
int id_face1=face1->get_id(); |
3370 |
|
|
face1->get_vectorisation().calcule_axes_dinertie(T1,Dv1,p); |
3371 |
|
|
pT=p.transpose(); |
3372 |
|
|
G1= face1->get_vectorisation().calcule_barycentre(T1); |
3373 |
|
|
inertie_face1=face1->get_vectorisation().calcule_tenseur_inertie_base_locale(T1); |
3374 |
|
|
vector<OT_VECTEUR_4DD>& list_points1=face1->get_vectorisation().get_points_controle(); |
3375 |
|
|
vector<OT_VECTEUR_4DD>& list_vecteurs1=face1->get_vectorisation().get_vecteurs(); |
3376 |
|
|
OT_VECTEUR_4DD Normal1(0.,0.,0.,0.),N1; |
3377 |
|
|
OT_VECTEUR_4DD axe11,axe12,axe13; |
3378 |
|
|
int cmpt=0; |
3379 |
|
|
|
3380 |
|
|
OT_VECTEUR_4DD v11= list_vecteurs1[0]; |
3381 |
|
|
int nb_vecteur1=list_vecteurs1.size(); |
3382 |
|
|
for (unsigned int pi=0;pi<nb_vecteur1-1;pi++) |
3383 |
|
|
{ |
3384 |
|
|
|
3385 |
|
|
OT_VECTEUR_4DD v2= list_vecteurs1[pi+1]; |
3386 |
|
|
if (pi==0) |
3387 |
|
|
Normal1=v11^v2; |
3388 |
|
|
if (pi>0) |
3389 |
|
|
N1=v11^v2; |
3390 |
|
|
OT_VECTEUR_4DD colineaire= Normal1^N1; |
3391 |
|
|
if (colineaire==VNul) |
3392 |
|
|
{ |
3393 |
|
|
cmpt++; |
3394 |
|
|
} |
3395 |
|
|
} |
3396 |
|
|
vector<OT_VECTEUR_4DD> axes1; |
3397 |
|
|
if ( cmpt== list_vecteurs1.size()-1) |
3398 |
|
|
{ |
3399 |
|
|
plan=1; |
3400 |
|
|
axe11=list_vecteurs1[0]; |
3401 |
|
|
axe12=Normal1^axe11; |
3402 |
|
|
axe13=Normal1; |
3403 |
|
|
axes1.insert(axes1.end(),axe11); |
3404 |
|
|
axes1.insert(axes1.end(),axe12); |
3405 |
|
|
axes1.insert(axes1.end(),axe13); |
3406 |
|
|
} |
3407 |
|
|
|
3408 |
|
|
VCT_OUTILS VOUTIL(4); |
3409 |
|
|
OT_MATRICE_3D sys_axes1=VOUTIL.get_system_axes(G1,axes1,list_points1) ; |
3410 |
|
|
|
3411 |
|
|
for (int r=0;r<4;r++) |
3412 |
|
|
{ |
3413 |
|
|
iface1.insert( iface1.end(), inertie_face1(r,r)); |
3414 |
|
|
} |
3415 |
|
|
|
3416 |
|
|
for (int j=4;j<nb_face2;j++) |
3417 |
|
|
{ |
3418 |
|
|
OT_TENSEUR inertie_face2(4); |
3419 |
|
|
vector<double2> iface2; |
3420 |
|
|
MG_FACE* face2=mggeo2->get_mg_face(j); |
3421 |
|
|
int id_face2=face2->get_id(); |
3422 |
|
|
face2->get_vectorisation().calcule_axes_dinertie(T2,Dv2,q); |
3423 |
|
|
G2= face2->get_vectorisation().calcule_barycentre(T2); |
3424 |
|
|
qT=q.transpose(); |
3425 |
|
|
inertie_face2=face2->get_vectorisation().calcule_tenseur_inertie_base_locale(T2); |
3426 |
|
|
vector<OT_VECTEUR_4DD>& list_points2=face2->get_vectorisation().get_points_controle(); |
3427 |
|
|
vector<OT_VECTEUR_4DD>& list_vecteurs2=face2->get_vectorisation().get_vecteurs(); |
3428 |
|
|
OT_VECTEUR_4DD Normal2(0.,0.,0.,0.),N1; |
3429 |
|
|
OT_VECTEUR_4DD axe21,axe22,axe23; |
3430 |
|
|
int cmpt=0; |
3431 |
|
|
OT_VECTEUR_4DD v21= list_vecteurs2[0]; |
3432 |
|
|
int nb_vecteur2=list_vecteurs2.size(); |
3433 |
|
|
for (unsigned int pj=0;pj<nb_vecteur2-1;pj++) |
3434 |
|
|
{ |
3435 |
|
|
OT_VECTEUR_4DD v2= list_vecteurs2[pj+1]; |
3436 |
|
|
if (pj==0) |
3437 |
|
|
Normal2=v21^v2; |
3438 |
|
|
if (pj>0) |
3439 |
|
|
N1=v21^v2; |
3440 |
|
|
OT_VECTEUR_4DD colineaire= Normal2^N1; |
3441 |
|
|
if (colineaire==VNul) |
3442 |
|
|
{ |
3443 |
|
|
cmpt++; |
3444 |
|
|
} |
3445 |
|
|
} |
3446 |
|
|
vector<OT_VECTEUR_4DD> axes2; |
3447 |
|
|
if ( cmpt== list_vecteurs2.size()-1) |
3448 |
|
|
{ |
3449 |
|
|
plan=1; |
3450 |
|
|
axe21=list_vecteurs2[0]; |
3451 |
|
|
axe22=Normal2^axe21; |
3452 |
|
|
axe23=Normal2; |
3453 |
|
|
axes2.insert(axes2.end(),axe21); |
3454 |
|
|
axes2.insert(axes2.end(),axe22); |
3455 |
|
|
axes2.insert(axes2.end(),axe23); |
3456 |
|
|
} |
3457 |
|
|
|
3458 |
|
|
VCT_OUTILS VOUTIL(4); |
3459 |
|
|
OT_MATRICE_3D sys_axes2=VOUTIL.get_system_axes(G2,axes2,list_points2) ; |
3460 |
|
|
|
3461 |
|
|
OT_MATRICE_3D T= sys_axes2*sys_axes1.transpose(); |
3462 |
|
|
|
3463 |
|
|
|
3464 |
|
|
|
3465 |
|
|
|
3466 |
|
|
|
3467 |
|
|
/* |
3468 |
|
|
for(int r=0;r<4;r++) |
3469 |
|
|
{ |
3470 |
|
|
iface2.insert( iface2.end(), inertie_face2(r,r)); |
3471 |
|
|
} |
3472 |
|
|
vector<unsigned int> indx1,indx2; |
3473 |
|
|
OT_TENSEUR T=q*pT; |
3474 |
|
|
|
3475 |
|
|
if(inertie_face2.listes_equivalentes(iface1,iface2,indx1)) |
3476 |
|
|
{ |
3477 |
|
|
|
3478 |
|
|
for(int ii=0;ii<list_points1.size();ii++) |
3479 |
|
|
{ |
3480 |
|
|
OT_VECTEUR_4DD pt1= list_points1[ii]; |
3481 |
|
|
OT_VECTEUR_4DD pt11; |
3482 |
|
|
|
3483 |
|
|
for(int r=0;r<4;r++) |
3484 |
|
|
{ |
3485 |
|
|
for(int s=0;s<4;s++) |
3486 |
|
|
pt11[r]=pt11[r]+T(r,s)*G1[s]; |
3487 |
|
|
} |
3488 |
|
|
|
3489 |
|
|
for(int jj=0;jj<list_points2.size();jj++) |
3490 |
|
|
{ |
3491 |
|
|
OT_VECTEUR_4DD pt2= list_points2[jj]; |
3492 |
|
|
OT_VECTEUR_4DD pt22; |
3493 |
|
|
for(int r=0;r<4;r++) |
3494 |
|
|
{ |
3495 |
|
|
for(int s=0;s<4;s++) |
3496 |
|
|
pt22[r]=pt22[r]+T(r,s)*G2[s]; |
3497 |
|
|
} |
3498 |
|
|
if(pt11==G2) |
3499 |
|
|
{ |
3500 |
|
|
int g=0; |
3501 |
|
|
} |
3502 |
|
|
|
3503 |
|
|
|
3504 |
|
|
} |
3505 |
|
|
|
3506 |
|
|
|
3507 |
|
|
|
3508 |
|
|
} |
3509 |
|
|
|
3510 |
|
|
|
3511 |
|
|
} */ |
3512 |
|
|
|
3513 |
|
|
|
3514 |
|
|
} |
3515 |
|
|
} |
3516 |
|
|
|
3517 |
|
|
|
3518 |
|
|
} |
3519 |
|
|
|
3520 |
|
|
|
3521 |
|
|
|
3522 |
|
|
|
3523 |
|
|
|
3524 |
|
|
std::ostream& operator <<(std::ostream& os,VCT_COMPARAISON& vct_cmp) |
3525 |
|
|
{ |
3526 |
|
|
vct_cmp.enregistrer(os) ; |
3527 |
|
|
return os; |
3528 |
|
|
} |
3529 |
|
|
|
3530 |
|
|
|
3531 |
|
|
|
3532 |
|
|
|
3533 |
|
|
|
3534 |
|
|
void VCT_COMPARAISON::enregistrer(ostream& os) |
3535 |
|
|
{ |
3536 |
|
|
os<<"COMPARAISON VECTORIELLE DE DEUX GEOMETRIES"<<endl; |
3537 |
|
|
int nb_cl=2; |
3538 |
|
|
int nb_lg=similarite.get_nb()/2; |
3539 |
|
|
os<<"FACES_PREMIERE_GEOMETRIE : "; |
3540 |
|
|
for (int j=0;j<nb_lg;j++) |
3541 |
|
|
os<<setw(5)<<similarite.get(j*nb_cl+0); |
3542 |
|
|
os<<endl; |
3543 |
|
|
os<<"FACES_SECONDE_GEOMETRIE : "; |
3544 |
|
|
for (int j=0;j<nb_lg;j++) |
3545 |
|
|
os<<setw(5)<<similarite.get(j*nb_cl+1); |
3546 |
|
|
os<<endl; |
3547 |
|
|
|
3548 |
|
|
//affecter_une_couleur(); |
3549 |
|
|
|
3550 |
|
|
|
3551 |
|
|
} |
3552 |
|
|
|
3553 |
|
|
|
3554 |
|
|
|
3555 |
|
|
int VCT_COMPARAISON::modele_a_change_de_repere() |
3556 |
|
|
{ |
3557 |
|
|
int nb_sommet1= mggeo1->get_nb_mg_sommet(); |
3558 |
|
|
int nb_sommet2= mggeo2->get_nb_mg_sommet(); |
3559 |
|
|
|
3560 |
|
|
int trouve=0; |
3561 |
|
|
int cmt=0; |
3562 |
|
|
for (int i=0;i<nb_sommet1;i++) |
3563 |
|
|
{ |
3564 |
|
|
double xyz1[3]; |
3565 |
|
|
OT_VECTEUR_4DD S1,s1; |
3566 |
|
|
MG_SOMMET *som1= |
3567 |
|
|
mggeo1->get_mg_sommet(i); |
3568 |
|
|
MG_POINT* pt1=som1->get_point(); |
3569 |
|
|
int som1_id=som1->get_id(); |
3570 |
|
|
pt1->evaluer(xyz1); |
3571 |
|
|
for (int t=0;t<3;t++) s1[t]=xyz1[t]; |
3572 |
|
|
|
3573 |
|
|
|
3574 |
|
|
for (int j=0;j<nb_sommet2;j++) |
3575 |
|
|
{ |
3576 |
|
|
double xyz2[3]; |
3577 |
|
|
OT_VECTEUR_4DD S2,s2; |
3578 |
|
|
MG_SOMMET *som2=mggeo2->get_mg_sommet(j); |
3579 |
|
|
MG_POINT* pt2=som2->get_point(); |
3580 |
|
|
int som2_id=som2->get_id(); |
3581 |
|
|
pt2->evaluer(xyz2); |
3582 |
|
|
for (int t=0;t<3;t++) s2[t]=xyz2[t]; |
3583 |
|
|
|
3584 |
|
|
|
3585 |
|
|
if (s1==s2) |
3586 |
|
|
{ |
3587 |
|
|
trouve=1; |
3588 |
|
|
break; |
3589 |
|
|
} |
3590 |
|
|
|
3591 |
|
|
} |
3592 |
|
|
if (trouve==-1) return trouve; |
3593 |
|
|
} |
3594 |
|
|
|
3595 |
|
|
|
3596 |
|
|
return trouve; |
3597 |
|
|
|
3598 |
|
|
} |
3599 |
|
|
|
3600 |
|
|
#endif |