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