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