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