MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
tpl_octree.h
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// tpl_octree.h
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:54:00 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #ifndef _TPLOCTREE_
23 #define _TPLOCTREE_
24 
25 
26 #include "ot_boite_3d.h"
27 #include "tpl_liste_entite.h"
28 #include "tpl_map_entite.h"
29 #include <math.h>
30 /*
31 */
32 
34 {
35 public:
37  {
38  };
40  {
41  };
42 
43 unsigned long determine_keycode(int nx,int ny,int nz)
44 {
45 std::vector<int> bits;
46 int ok=0,i=0;
47 do
48  {
49  int nnz=nz>>i;
50  int nny=ny>>i;
51  int nnx=nx>>i;
52  int bit1= nnz & 1;
53  int bit2= nny & 1;
54  int bit3= nnx & 1;
55  if ((nnz==0) && (nny==0) && (nnx==0)) ok=1;
56  bits.insert(bits.end(),bit1);
57  bits.insert(bits.end(),bit2);
58  bits.insert(bits.end(),bit3);
59  i++;
60  }
61 while (ok==0);
62 unsigned long keycode=0;
63 for (int i=0;i<bits.size();i++)
64  keycode=keycode+bits[i]*(1<<i);
65 return keycode;
66 }
67 
68 
69 bool adjacent(int direction,int octant)
70 {
71 bool tabadj[18][8]=
72 {
73 {true, true, true, true, false, false, false, false},
74 {true, true, false, false, true, true, false, false},
75 {false, true, false, true, false, true, false, true},
76 {false, false, true, true, false, false, true, true},
77 {true, false, true, false, true, false, true, false},
78 {false, false, false, false, true, true, true, true},
79 {true, true, false, false, false, false, false, false},
80 {true, false, true, false, false, false, false, false},
81 {true, false, false, false, true, false, false, false},
82 {false, true, false, true, false, false, false, false},
83 {false, true, false, false, false, true, false, false},
84 {false, false, true, true, false, false, false, false},
85 {false, false, false, true, false, false, false, true},
86 {false, false, true, false, false, false, true, false},
87 {false, false, false, false, true, true, false, false},
88 {false, false, false, false, true, false, true, false},
89 {false, false, false, false, false, true, false, true},
90 {false, false, false, false, false, false, true, true},
91 
92 };
93 
94 return tabadj[direction][octant];
95 }
96 
97 
98 int reflect(int direction,int octant)
99 {
100 int tabreflect[18][8]=
101 {
102 {4, 5, 6, 7, 0, 1, 2, 3},
103 {2, 3, 0, 1, 6, 7, 4, 5},
104 {1, 0, 3, 2, 5, 4, 7, 6},
105 {2, 3, 0, 1, 6, 7, 4, 5},
106 {1, 0, 3, 2, 5, 4, 7, 6},
107 {4, 5, 6, 7, 0, 1, 2, 3},
108 {6, 7, 4, 5, 2, 3, 0, 1},
109 {5, 4, 7, 6, 1, 0, 3, 2},
110 {3, 2, 1, 0, 7, 6, 5, 4},
111 {5, 4, 7, 6, 1, 0, 3, 2},
112 {3, 2, 1, 0, 7, 6, 5, 4},
113 {6, 7, 4, 5, 2, 3, 0, 1},
114 {3, 2, 1, 0, 7, 6, 5, 4},
115 {3, 2, 1, 0, 7, 6, 5, 4},
116 {6, 7, 4, 5, 2, 3, 0, 1},
117 {5, 4, 7, 6, 1, 0, 3, 2},
118 {5, 4, 7, 6, 1, 0, 3, 2},
119 {6, 7, 4, 5, 2, 3, 0, 1}
120 
121 };
122 
123 return tabreflect[direction][octant];
124 }
125 
126 
127 
128 int commonface(int direction,int octant)
129 {
130 int tabcommonface[12][8]=
131 {
132 {-1, -1, 0, 0, 1, 1, -1, -1},
133 {-1, 0, -1, 0, 4, -1, 4, -1},
134 {-1, 1, 4, -1, -1, 1, 4, -1},
135 {0, -1, 0, -1, -1, 2, -1, 2},
136 {1, -1, -1, 2, 1, -1, -1, 2},
137 {0, 0, -1, -1, -1, -1, 3, 3},
138 {-1, 2, 3, -1, -1, 2, 3, -1},
139 {4, -1, -1, 3, 4, -1, -1, 3},
140 {1, 1, -1, -1, -1, -1, 5, 5},
141 {4, -1, 4, -1, -1, 5, -1, 5},
142 {-1, 2, -1, 2, 5, -1, 5, -1},
143 {-1, -1, 3, 3, 5, 5, -1, -1},
144 } ;
145 return tabcommonface[direction-6][octant];
146 
147 }
148 
149 int filsvoisin(int direction,int numvoisin)
150 {
151 int tab[6][4]=
152 {
153 {4, 5, 6, 7},
154 {2, 3, 6, 7},
155 {0, 2, 4, 6},
156 {0, 1, 4, 5},
157 {1, 3, 5, 7},
158 {0, 1, 2, 3}
159 };
160 return tab[direction][numvoisin];
161 }
162 
163 int sommetface(int numface,int numsommet)
164 {
165 int tab[6][4]=
166 {
167 {0,1,2,3},
168 {0,1,5,4},
169 {1,2,6,5},
170 {3,2,6,7},
171 {0,3,7,4},
172 {4,5,6,7},
173 };
174 return tab[numface][numsommet];
175 }
176 
177 int sommetarete(int numarete,int numsommet)
178 {
179 int tab[12][2]=
180 {
181 {0,1},
182 {0,3},
183 {0,4},
184 {1,2},
185 {1,5},
186 {3,2},
187 {2,6},
188 {3,7},
189 {4,5},
190 {4,7},
191 {5,6},
192 {7,6},
193 };
194 return tab[numarete-6][numsommet];
195 }
196 
197 
198 
199 
200 
201 int areteface(int numface,int numarete)
202 {
203 int tab[6][4]=
204 {
205 {6,9,11,7},
206 {6,10,14,8},
207 {9,12,16,10},
208 {11,12,17,13},
209 {7,13,15,8},
210 {14,16,17,15},
211 };
212 return tab[numface][numarete];
213 }
214 
215 int faceadjacente(int numface,int numarete)
216 {
217 int tab[6][4]=
218 {
219 {1,2,3,4},
220 {0,2,5,4},
221 {0,3,5,1},
222 {0,2,5,4},
223 {0,3,5,1},
224 {1,2,3,4},
225 };
226 return tab[numface][numarete];
227 }
228 
229 
230 
231 };
232 
233 
235 {
236 public:
238  {
239  static unsigned long idmax=0;
240  id=idmax;
241  idmax++;
242  };
243 
244  virtual ~CELLULE_OCTREE_BASE() {};
245  virtual BOITE_3D get_boite(void)=0;
246  virtual CELLULE_OCTREE_BASE* get_fils(int num)=0;
247  virtual int get_feuille(void)=0;
248  virtual int get_niveau(void)=0;
249  virtual int get_sontype(void)=0;
250  virtual unsigned long get_id() {return id;};
251  unsigned long id;
252 };
253 
254 
256 {
257  public:
259  virtual ~OCTREE_BASE() {};
260  virtual int get_nb_cellule(void)=0;
261  virtual CELLULE_OCTREE_BASE* get_cellule(int num)=0;
262  virtual int get_niveau_max(void)=0;
263 };
264 
265 
266 template <class A,class CONDITION>
268 {
269 public:
270  TPL_CELLULE_OCTREE(TPL_CELLULE_OCTREE<A,CONDITION> *cell,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax,int niv,int st):CELLULE_OCTREE_BASE(),boite(xmin,ymin,zmin,xmax,ymax,zmax),niveau(niv),pere(cell),sontype(st)
271  {
272  fils[0]=NULL;fils[1]=NULL;fils[2]=NULL;fils[3]=NULL;fils[4]=NULL;fils[5]=NULL;fils[6]=NULL;fils[7]=NULL;
273  };
274 virtual ~TPL_CELLULE_OCTREE() {};
275 BOITE_3D get_boite(void) {return boite;};
276 int get_niveau(void) {return niveau;};
281 virtual TPL_CELLULE_OCTREE<A,CONDITION>* get_fils(int num) {return fils[num];};
283 virtual int get_feuille(void) {return feuille;};
284 
285 virtual void vide(void)
286 {
288 }
289 
290 int get_sontype(void)
291 {
292 return sontype;
293 }
294 int get_nb_entite(void)
295 {
296 return lst_entite_A.get_nb();
297 };
298 A get_entite(int num)
299 {
300 return lst_entite_A.get(num);
301 };
304 
305 
306 int niveau;
308 };
309 
310 template <class A,class CONDITION,class B>
312 {
313 public:
314  TPL_CELLULE_INFO(double xmin,double ymin,double zmin,double xmax,double ymax,double zmax):CELLULE_OCTREE_BASE(),boite(xmin,ymin,zmin,xmax,ymax,zmax)
315  {
316  };
317 virtual ~TPL_CELLULE_INFO() {};
318 BOITE_3D get_boite(void) {return boite;};
324 B tab[8];
325 virtual TPL_CELLULE_INFO<A,CONDITION,B>* get_fils(int num) {return fils[num];};
326 virtual int get_feuille(void) {return feuille;};
327 int get_nb_entite(void)
328 {
329 return lst_entite_A.get_nb();
330 };
331 A get_entite(int num)
332 {
333 return lst_entite_A.get(num);
334 };
335 
336 B get_info(int num) {return tab[num];};
337 void change_info(int num,B val) {tab[num]=val;};
338 
339 };
340 
341 
342 
343 template <class A,class CONDITION>
345 {
346 public:
348 virtual ~TPL_OCTREE()
349 {
350  for (int i1=0;i1<lst_entite_cellule.get_nb();i1++)
351  {
353  delete cellule;
354  }
355 };
356 
357 virtual int get_nb_cellule(void) {return lst_entite_cellule.get_nb();};
358 virtual int get_nb_feuille(void) {return lst_entite_feuille.get_nb();};
359 
360 virtual BOITE_3D get_boite_de_base(void) {return lst_entite_cellule.get(0)->get_boite();};
361 
364 
365 
366 virtual void initialiser(TPL_LISTE_ENTITE<CONDITION>* lst_entite,int nombre,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
367  {
368  TPL_CELLULE_OCTREE<A ,CONDITION>* root_cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(NULL,xmin,ymin,zmin,xmax,ymax,zmax,0,-1);
369  lst_entite_cellule.ajouter(root_cellule);
370  for (int i=0;i<lst_entite->get_nb();i++)
371  {
372  CONDITION cond=lst_entite->get(i);
373  BOITE_3D boite_cond=cond->get_boite_3D();
374  if (boite_cond*root_cellule->boite) root_cellule->lst_entite_CONDITION.ajouter(cond);
375  }
376  if (root_cellule->lst_entite_CONDITION.get_nb()>nombre)
377  {
378  root_cellule->feuille=0;
379  double dx=xmax-xmin;
380  double dy=ymax-ymin;
381  double dz=zmax-zmin;
382  root_cellule->fils[0]=cree_fils(root_cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,0);
383  root_cellule->fils[1]=cree_fils(root_cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,1);
384  root_cellule->fils[2]=cree_fils(root_cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,2);
385  root_cellule->fils[3]=cree_fils(root_cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,3);
386  root_cellule->fils[4]=cree_fils(root_cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,4);
387  root_cellule->fils[5]=cree_fils(root_cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,5);
388  root_cellule->fils[6]=cree_fils(root_cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,6);
389  root_cellule->fils[7]=cree_fils(root_cellule,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,7);
390  }
391  else root_cellule->feuille=1;
392  for (int j=0;j<lst_entite_cellule.get_nb();j++)
393  {
395  cellule->lst_entite_CONDITION.vide();
396  }
397  }
398 
399 virtual void initialiser(TPL_MAP_ENTITE<CONDITION>* lst_entite,int nombre,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
400  {
401  TPL_CELLULE_OCTREE<A ,CONDITION>* root_cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(NULL,xmin,ymin,zmin,xmax,ymax,zmax,0,-1);
402  lst_entite_cellule.ajouter(root_cellule);
404  for (CONDITION cond=lst_entite->get_premier(it);cond!=NULL;cond=lst_entite->get_suivant(it))
405  {
406  BOITE_3D boite_cond=cond->get_boite_3D();
407  if (boite_cond*root_cellule->boite) root_cellule->lst_entite_CONDITION.ajouter(cond);
408  }
409  if (root_cellule->lst_entite_CONDITION.get_nb()>nombre)
410  {
411  root_cellule->feuille=0;
412  double dx=xmax-xmin;
413  double dy=ymax-ymin;
414  double dz=zmax-zmin;
415  root_cellule->fils[0]=cree_fils(root_cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,0);
416  root_cellule->fils[1]=cree_fils(root_cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,1);
417  root_cellule->fils[2]=cree_fils(root_cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,2);
418  root_cellule->fils[3]=cree_fils(root_cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,3);
419  root_cellule->fils[4]=cree_fils(root_cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,4);
420  root_cellule->fils[5]=cree_fils(root_cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,5);
421  root_cellule->fils[6]=cree_fils(root_cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,6);
422  root_cellule->fils[7]=cree_fils(root_cellule,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,7);
423  }
424  else root_cellule->feuille=1;
425  for (int j=0;j<lst_entite_cellule.get_nb();j++)
426  {
428  cellule->lst_entite_CONDITION.vide();
429  }
430  }
431 
432 virtual void initialiser2D(int dimanepasdecouper,TPL_LISTE_ENTITE<CONDITION>* lst_entite,int nombre,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
433  {
434  TPL_CELLULE_OCTREE<A ,CONDITION>* root_cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(NULL,xmin,ymin,zmin,xmax,ymax,zmax,0,-1);
435  lst_entite_cellule.ajouter(root_cellule);
436  for (int i=0;i<lst_entite->get_nb();i++)
437  {
438  CONDITION cond=lst_entite->get(i);
439  BOITE_3D boite_cond=cond->get_boite_3D();
440  if (boite_cond*root_cellule->boite) root_cellule->lst_entite_CONDITION.ajouter(cond);
441  }
442  if (root_cellule->lst_entite_CONDITION.get_nb()>nombre)
443  {
444  root_cellule->feuille=0;
445  double dx=xmax-xmin;
446  double dy=ymax-ymin;
447  double dz=zmax-zmin;
448  if (dimanepasdecouper==3)
449  {
450  root_cellule->fils[0]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz,&(root_cellule->lst_entite_CONDITION),nombre,1,0);
451  root_cellule->fils[1]=cree_fils2D(dimanepasdecouper,root_cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz,&(root_cellule->lst_entite_CONDITION),nombre,1,1);
452  root_cellule->fils[2]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz,&(root_cellule->lst_entite_CONDITION),nombre,1,2);
453  root_cellule->fils[3]=cree_fils2D(dimanepasdecouper,root_cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz,&(root_cellule->lst_entite_CONDITION),nombre,1,3);
454  }
455  if (dimanepasdecouper==2)
456  {
457  root_cellule->fils[0]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin,zmin,dx/2.,dy,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,0);
458  root_cellule->fils[1]=cree_fils2D(dimanepasdecouper,root_cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,1);
459  root_cellule->fils[4]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,4);
460  root_cellule->fils[5]=cree_fils2D(dimanepasdecouper,root_cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,5);
461  }
462  if (dimanepasdecouper==1)
463  {
464  root_cellule->fils[0]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin,zmin,dx,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,0);
465  root_cellule->fils[2]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin+dy/2.,zmin,dx,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,2);
466  root_cellule->fils[4]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin,zmin+dz/2.,dx,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,4);
467  root_cellule->fils[6]=cree_fils2D(dimanepasdecouper,root_cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre,1,6);
468  }
469  }
470  else root_cellule->feuille=1;
471  for (int j=0;j<lst_entite_cellule.get_nb();j++)
472  {
474  cellule->lst_entite_CONDITION.vide();
475  }
476  }
477 
478 virtual void initialiser(OCTREE_BASE* oc)
479 {
480  BOITE_3D boite=oc->get_cellule(0)->get_boite();
481  double xmin=boite.get_xmin();
482  double xmax=boite.get_xmax();
483  double ymin=boite.get_ymin();
484  double ymax=boite.get_ymax();
485  double zmin=boite.get_zmin();
486  double zmax=boite.get_zmax();
487  TPL_CELLULE_OCTREE<A ,CONDITION>* cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(NULL,xmin,ymin,zmin,xmax,ymax,zmax,0,oc->get_cellule(0)->get_sontype());
488  lst_entite_cellule.ajouter(cellule);
490  cellule->feuille=oc->get_cellule(0)->get_feuille();
491  if (oc->get_cellule(0)->get_feuille()==0)
492  {
493  if (oc->get_cellule(0)->get_fils(0)!=NULL) cellule->fils[0]=cree_fils(cellule,oc->get_cellule(0)->get_fils(0),0);
494  if (oc->get_cellule(0)->get_fils(1)!=NULL) cellule->fils[1]=cree_fils(cellule,oc->get_cellule(0)->get_fils(1),1);
495  if (oc->get_cellule(0)->get_fils(2)!=NULL) cellule->fils[2]=cree_fils(cellule,oc->get_cellule(0)->get_fils(2),2);
496  if (oc->get_cellule(0)->get_fils(3)!=NULL) cellule->fils[3]=cree_fils(cellule,oc->get_cellule(0)->get_fils(3),3);
497  if (oc->get_cellule(0)->get_fils(4)!=NULL) cellule->fils[4]=cree_fils(cellule,oc->get_cellule(0)->get_fils(4),4);
498  if (oc->get_cellule(0)->get_fils(5)!=NULL) cellule->fils[5]=cree_fils(cellule,oc->get_cellule(0)->get_fils(5),5);
499  if (oc->get_cellule(0)->get_fils(6)!=NULL) cellule->fils[6]=cree_fils(cellule,oc->get_cellule(0)->get_fils(6),6);
500  if (oc->get_cellule(0)->get_fils(7)!=NULL) cellule->fils[7]=cree_fils(cellule,oc->get_cellule(0)->get_fils(7),7);
501  }
502  else {cellule->feuille=1;lst_entite_feuille.ajouter(cellule);}
503 };
504 
505 
507 {
508  BOITE_3D boite=cellule_base->get_boite();
509  double xmin=boite.get_xmin();
510  double xmax=boite.get_xmax();
511  double ymin=boite.get_ymin();
512  double ymax=boite.get_ymax();
513  double zmin=boite.get_zmin();
514  double zmax=boite.get_zmax();
515  TPL_CELLULE_OCTREE<A ,CONDITION>* cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(cell,xmin,ymin,zmin,xmax,ymax,zmax,cellule_base->get_niveau(),st);
516  lst_entite_cellule.ajouter(cellule);
517  if (niveaumax<cellule_base->get_niveau()) niveaumax=cellule_base->get_niveau();
518  if (cellule_base->get_feuille()==1)
519  {
520  {cellule->feuille=1;lst_entite_feuille.ajouter(cellule);}
521  }
522  else
523  {
524  if (cellule_base->get_fils(0)!=NULL) cellule->fils[0]=cree_fils(cellule,cellule_base->get_fils(0),0);
525  if (cellule_base->get_fils(1)!=NULL) cellule->fils[1]=cree_fils(cellule,cellule_base->get_fils(1),1);
526  if (cellule_base->get_fils(2)!=NULL) cellule->fils[2]=cree_fils(cellule,cellule_base->get_fils(2),2);
527  if (cellule_base->get_fils(3)!=NULL) cellule->fils[3]=cree_fils(cellule,cellule_base->get_fils(3),3);
528  if (cellule_base->get_fils(4)!=NULL) cellule->fils[4]=cree_fils(cellule,cellule_base->get_fils(4),4);
529  if (cellule_base->get_fils(5)!=NULL) cellule->fils[5]=cree_fils(cellule,cellule_base->get_fils(5),5);
530  if (cellule_base->get_fils(6)!=NULL) cellule->fils[6]=cree_fils(cellule,cellule_base->get_fils(6),6);
531  if (cellule_base->get_fils(7)!=NULL) cellule->fils[7]=cree_fils(cellule,cellule_base->get_fils(7),7);
532  cellule->feuille=cellule_base->get_feuille();
533  }
534 return cellule;
535 };
536 
537 virtual TPL_CELLULE_OCTREE<A ,CONDITION>* cree_fils(TPL_CELLULE_OCTREE<A ,CONDITION>* cell,double xmin,double ymin,double zmin,double dx,double dy,double dz,TPL_LISTE_ENTITE<CONDITION>* lst_entite,int nombre,int niv,int st)
538  {
539  TPL_CELLULE_OCTREE<A ,CONDITION>* cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(cell,xmin,ymin,zmin,xmin+dx,ymin+dy,zmin+dz,niv,st);
540  lst_entite_cellule.ajouter(cellule);
541  if (niveaumax<niv) niveaumax=niv;
542  for (int i=0;i<lst_entite->get_nb();i++)
543  {
544  CONDITION cond=lst_entite->get(i);
545  BOITE_3D boite_cond=cond->get_boite_3D();
546  if (boite_cond*cellule->boite) cellule->lst_entite_CONDITION.ajouter(cond);
547  }
548  if ((cellule->lst_entite_CONDITION.get_nb()>nombre) && (niveaumax<niveaumaxlim))
549  {
550  cellule->feuille=0;
551  cellule->fils[0]=cree_fils(cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,0);
552  cellule->fils[1]=cree_fils(cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,1);
553  cellule->fils[2]=cree_fils(cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,2);
554  cellule->fils[3]=cree_fils(cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,3);
555  cellule->fils[4]=cree_fils(cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,4);
556  cellule->fils[5]=cree_fils(cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,5);
557  cellule->fils[6]=cree_fils(cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,6);
558  cellule->fils[7]=cree_fils(cellule,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,7);
559  }
560  else {cellule->feuille=1;lst_entite_feuille.ajouter(cellule);}
561  return cellule;
562  }
563 
564 virtual TPL_CELLULE_OCTREE<A ,CONDITION>* cree_fils2D(int dimanepasdecouper,TPL_CELLULE_OCTREE<A ,CONDITION>* cell,double xmin,double ymin,double zmin,double dx,double dy,double dz,TPL_LISTE_ENTITE<CONDITION>* lst_entite,int nombre,int niv,int st)
565  {
566  TPL_CELLULE_OCTREE<A ,CONDITION>* cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(cell,xmin,ymin,zmin,xmin+dx,ymin+dy,zmin+dz,niv,st);
567  lst_entite_cellule.ajouter(cellule);
568  if (niveaumax<niv) niveaumax=niv;
569  dz=dz*2;
570  for (int i=0;i<lst_entite->get_nb();i++)
571  {
572  CONDITION cond=lst_entite->get(i);
573  BOITE_3D boite_cond=cond->get_boite_3D();
574  if (boite_cond*cellule->boite) cellule->lst_entite_CONDITION.ajouter(cond);
575  }
576  if (cellule->lst_entite_CONDITION.get_nb()>nombre)
577  {
578  cellule->feuille=0;
579  if (dimanepasdecouper==3)
580  {
581  cellule->fils[0]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz,&(cellule->lst_entite_CONDITION),nombre,niv+1,0);
582  cellule->fils[1]=cree_fils2D(dimanepasdecouper,cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz,&(cellule->lst_entite_CONDITION),nombre,niv+1,1);
583  cellule->fils[2]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz,&(cellule->lst_entite_CONDITION),nombre,niv+1,2);
584  cellule->fils[3]=cree_fils2D(dimanepasdecouper,cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz,&(cellule->lst_entite_CONDITION),nombre,niv+1,3);
585  }
586  if (dimanepasdecouper==2)
587  {
588  cellule->fils[0]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin,zmin,dx/2.,dy,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,0);
589  cellule->fils[1]=cree_fils2D(dimanepasdecouper,cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,1);
590  cellule->fils[4]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,4);
591  cellule->fils[5]=cree_fils2D(dimanepasdecouper,cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,5);
592  }
593  if (dimanepasdecouper==1)
594  {
595  cellule->fils[0]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin,zmin,dx,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,0);
596  cellule->fils[2]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin+dy/2.,zmin,dx,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,2);
597  cellule->fils[4]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin,zmin+dz/2.,dx,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,4);
598  cellule->fils[6]=cree_fils2D(dimanepasdecouper,cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre,niv+1,6);
599  }
600  }
601  else {cellule->feuille=1;lst_entite_feuille.ajouter(cellule);}
602  return cellule;
603  }
604 
605 
606 virtual void rechercher(BOITE_3D& boite,TPL_MAP_ENTITE<A>& liste_entite_trouve,TPL_CELLULE_OCTREE<A ,CONDITION>* cellule)
607 {
608 if (cellule==NULL) return;
609 if (boite*cellule->boite)
610  if (cellule->feuille==1)
611  {
612  for (int i=0;i<cellule->lst_entite_A.get_nb();i++)
613  if (boite*cellule->lst_entite_A.get(i)->get_boite_3D())
614  liste_entite_trouve.ajouter(cellule->lst_entite_A.get(i));
615  }
616 else
617  {
618  rechercher(boite,liste_entite_trouve,cellule->fils[0]);
619  rechercher(boite,liste_entite_trouve,cellule->fils[1]);
620  rechercher(boite,liste_entite_trouve,cellule->fils[2]);
621  rechercher(boite,liste_entite_trouve,cellule->fils[3]);
622  rechercher(boite,liste_entite_trouve,cellule->fils[4]);
623  rechercher(boite,liste_entite_trouve,cellule->fils[5]);
624  rechercher(boite,liste_entite_trouve,cellule->fils[6]);
625  rechercher(boite,liste_entite_trouve,cellule->fils[7]);
626  }
627 };
628 
629 
631 {
632 if (boite*cellule->boite)
633  if (cellule->feuille==1)
634  {
635  liste_entite.ajouter(cellule);
636  }
637 else
638  {
639  get_cellule(boite,cellule->fils[0],liste_entite);
640  get_cellule(boite,cellule->fils[1],liste_entite);
641  get_cellule(boite,cellule->fils[2],liste_entite);
642  get_cellule(boite,cellule->fils[3],liste_entite);
643  get_cellule(boite,cellule->fils[4],liste_entite);
644  get_cellule(boite,cellule->fils[5],liste_entite);
645  get_cellule(boite,cellule->fils[6],liste_entite);
646  get_cellule(boite,cellule->fils[7],liste_entite);
647  }
648 };
649 
651 {
653 OUTIL_OCTREE outil;
654 if (cellule->pere==NULL) cellule2=NULL;
655 else if (outil.adjacent(direction,cellule->get_sontype())) cellule2=get_cellule_adjacent(cellule->pere,direction);
656 else if (outil.commonface(direction,cellule->get_sontype())!=-1) cellule2=get_cellule_voisin(cellule->pere,outil.commonface(direction,cellule->get_sontype()));
657 else cellule2=cellule->pere;
658 if (cellule2!=NULL)
659  if (cellule2->get_feuille()==0)
660  return cellule2->get_fils(outil.reflect(direction,cellule->get_sontype()));
661 return cellule2;
662 }
663 
665 {
667 OUTIL_OCTREE outil;
668 if ((!(cellule->pere==NULL)) && (outil.adjacent(direction,cellule->get_sontype())))
669  cellule2=get_cellule_voisin(cellule->pere,direction);
670  else
671  cellule2=cellule->pere;
672 if (cellule2!=NULL)
673  if (cellule2->feuille==0)
674  return cellule2->get_fils(outil.reflect(direction,cellule->get_sontype()));
675 return cellule2;
676 }
677 
678 
679 
680 
681 virtual void get_feuille_voisins(TPL_CELLULE_OCTREE<A,CONDITION> * cellule,int direction,std::vector<TPL_CELLULE_OCTREE<A,CONDITION> *> *lst)
682 {
683 OUTIL_OCTREE outil;
684 lst->clear();
685 TPL_CELLULE_OCTREE<A,CONDITION> *cellule2=get_cellule_voisin(cellule,direction);
686 if (cellule2!=NULL) lst->insert(lst->end(),cellule2);
687 int i=0;
688 while (i<lst->size())
689  {
690  TPL_CELLULE_OCTREE<A,CONDITION> *cell=(*lst)[i];
691  if (cell->feuille==0)
692  {
693  lst->insert(lst->end(),cell->get_fils(outil.filsvoisin(direction,0)));
694  lst->insert(lst->end(),cell->get_fils(outil.filsvoisin(direction,1)));
695  lst->insert(lst->end(),cell->get_fils(outil.filsvoisin(direction,2)));
696  lst->insert(lst->end(),cell->get_fils(outil.filsvoisin(direction,3)));
697  }
698  i++;
699  }
700 typename std::vector<TPL_CELLULE_OCTREE<A,CONDITION> * >::iterator j=lst->end();
701 while (j!=lst->begin())
702 {
703 j--;
705 if (cell->feuille==0)
706  lst->erase(j);
707 
708 }
709 }
710 
711 virtual TPL_CELLULE_OCTREE<A,CONDITION> *get_cellule(double x,double y, double z)
712 {
713 BOITE_3D boite(x,y,z,x,y,z);
716 get_cellule(boite,cellule,liste_cellule);
717 if (liste_cellule.get_nb()==1) return liste_cellule.get(0);
718 return NULL;
719 };
720 
721 
722 virtual unsigned long get_cellule_keycode(int numcellule,int numsommet)
723 {
725 return get_keycode(cellule,numsommet);
726 }
727 
728 virtual unsigned long get_feuille_keycode(int numcellule,int numsommet)
729 {
731 return get_keycode(cellule,numsommet);
732 }
733 
734 virtual unsigned long get_keycode(TPL_CELLULE_OCTREE<A ,CONDITION>* cellule,int numsommet)
735 {
737 
738 double x=cellule->boite.get_xmin();
739 double y=cellule->boite.get_ymin();
740 double z=cellule->boite.get_zmin();
741 double xx=cellule->boite.get_xmax();
742 double yy=cellule->boite.get_ymax();
743 double zz=cellule->boite.get_zmax();
744 double somx=x,somy=y,somz=z;
745 if (numsommet==1) somx=xx;
746 if (numsommet==2) {somx=xx;somy=yy;}
747 if (numsommet==3) somy=yy;
748 if (numsommet==4) somz=zz;
749 if (numsommet==5) {somx=xx;somz=zz;}
750 if (numsommet==6) {somx=xx;somy=yy;somz=zz;}
751 if (numsommet==7) {somy=yy;somz=zz;}
752 double nx=0.1+(somx-root->boite.get_xmin())/(root->boite.get_xmax()-root->boite.get_xmin())*(1<<get_niveau_max());
753 double ny=0.1+(somy-root->boite.get_ymin())/(root->boite.get_ymax()-root->boite.get_ymin())*(1<<get_niveau_max());
754 double nz=0.1+(somz-root->boite.get_zmin())/(root->boite.get_zmax()-root->boite.get_zmin())*(1<<get_niveau_max());
755 OUTIL_OCTREE outil;
756 return outil.determine_keycode(nx,ny,nz);
757 }
758 
759 virtual unsigned long get_keycode(double x,double y,double z)
760 {
762 double nx=0.1+(x-root->boite.get_xmin())/(root->boite.get_xmax()-root->boite.get_xmin())*(1<<get_niveau_max());
763 double ny=0.1+(y-root->boite.get_ymin())/(root->boite.get_ymax()-root->boite.get_ymin())*(1<<get_niveau_max());
764 double nz=0.1+(z-root->boite.get_zmin())/(root->boite.get_zmax()-root->boite.get_zmin())*(1<<get_niveau_max());
765 OUTIL_OCTREE outil;
766 return outil.determine_keycode(nx,ny,nz);
767 }
768 
769 
770 
771 virtual void get_xyzsommet_cellule(int numcellule,int numsommet,double &x,double &y,double &z)
772 {
774 x=cellule->boite.get_xmin();
775 y=cellule->boite.get_ymin();
776 z=cellule->boite.get_zmin();
777 double xx=cellule->boite.get_xmax();
778 double yy=cellule->boite.get_ymax();
779 double zz=cellule->boite.get_zmax();
780 if (numsommet==1) x=xx;
781 if (numsommet==2) {x=xx;y=yy;}
782 if (numsommet==3) y=yy;
783 if (numsommet==4) z=zz;
784 if (numsommet==5) {x=xx;z=zz;}
785 if (numsommet==6) {x=xx;y=yy;z=zz;}
786 if (numsommet==7) {y=yy;z=zz;}
787 }
788 
789 virtual void get_xyzsommet_feuille(int numcellule,int numsommet,double &x,double &y,double &z)
790 {
792 x=cellule->boite.get_xmin();
793 y=cellule->boite.get_ymin();
794 z=cellule->boite.get_zmin();
795 double xx=cellule->boite.get_xmax();
796 double yy=cellule->boite.get_ymax();
797 double zz=cellule->boite.get_zmax();
798 if (numsommet==1) x=xx;
799 if (numsommet==2) {x=xx;y=yy;}
800 if (numsommet==3) y=yy;
801 if (numsommet==4) z=zz;
802 if (numsommet==5) {x=xx;z=zz;}
803 if (numsommet==6) {x=xx;y=yy;z=zz;}
804 if (numsommet==7) {y=yy;z=zz;}
805 }
806 
807 
808 
809 virtual void equilibre(int niveauequilibre=1)
810 {
811 int ok=0;
812 do
813 {
814 int nbfeuilleavant=get_nb_feuille();
815 std::vector< TPL_CELLULE_OCTREE<A,CONDITION> *> lstraf;
816 for (int i=0;i<lst_entite_feuille.get_nb();i++)
817  {
819  int niveaumaxvoisin=0;
820  for (int j=0;j<6;j++)
821  {
822  std::vector< TPL_CELLULE_OCTREE<A,CONDITION> *> lstvoi;
823  get_feuille_voisins(feuille,j,&lstvoi);
824  int nb_feuille=lstvoi.size();
825  for (int k=0;k<nb_feuille;k++)
826  {
827  int niveau=lstvoi[k]->get_niveau();
828  if (niveau>niveaumaxvoisin) niveaumaxvoisin=niveau;
829  }
830 
831  }
832  if (niveaumaxvoisin-feuille->get_niveau()>niveauequilibre) {lstraf.insert(lstraf.end(),feuille);feuille->feuille=niveaumaxvoisin-niveauequilibre;}
833  }
834 int nbcelluleraffiner=lstraf.size();
835 for (int i=0;i<nbcelluleraffiner;i++)
836  {
837  TPL_CELLULE_OCTREE<A,CONDITION> *cell=lstraf[i];
839  int niveauatteindre=cell->feuille;
840  int niveau=cell->niveau;
841  cell->feuille=0;
842  double xmin=cell->boite.get_xmin();
843  double ymin=cell->boite.get_ymin();
844  double zmin=cell->boite.get_zmin();
845  double dx=cell->boite.get_xmax()-cell->boite.get_xmin();
846  double dy=cell->boite.get_ymax()-cell->boite.get_ymin();
847  double dz=cell->boite.get_zmax()-cell->boite.get_zmin();
848 
849  cell->fils[0]=cree_fils(cell,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,0);
850  cell->fils[1]=cree_fils(cell,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,1);
851  cell->fils[2]=cree_fils(cell,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,2);
852  cell->fils[3]=cree_fils(cell,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,3);
853  cell->fils[4]=cree_fils(cell,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,4);
854  cell->fils[5]=cree_fils(cell,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,5);
855  cell->fils[6]=cree_fils(cell,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,6);
856  cell->fils[7]=cree_fils(cell,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niveau+1,niveauatteindre,7);
857  }
858 int nbfeuilleapres=get_nb_feuille();
859 if (nbfeuilleapres==nbfeuilleavant) ok=1;
860 }
861 while (ok==0);
862 
863 
864 }
865 
866 virtual TPL_CELLULE_OCTREE<A ,CONDITION>* cree_fils(TPL_CELLULE_OCTREE<A ,CONDITION>* cell,double xmin,double ymin,double zmin,double dx,double dy,double dz,int niv,int niveauatteindre,int st)
867  {
868  TPL_CELLULE_OCTREE<A ,CONDITION>* cellule=new TPL_CELLULE_OCTREE<A ,CONDITION>(cell,xmin,ymin,zmin,xmin+dx,ymin+dy,zmin+dz,niv,st);
869  lst_entite_cellule.ajouter(cellule);
870  if (niveaumax<niv) niveaumax=niv;
871  if (cellule->get_niveau()!=niveauatteindre)
872  {
873  cellule->feuille=0;
874  cellule->fils[0]=cree_fils(cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,0);
875  cellule->fils[1]=cree_fils(cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,1);
876  cellule->fils[2]=cree_fils(cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,2);
877  cellule->fils[3]=cree_fils(cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,3);
878  cellule->fils[4]=cree_fils(cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,4);
879  cellule->fils[5]=cree_fils(cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,5);
880  cellule->fils[6]=cree_fils(cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,6);
881  cellule->fils[7]=cree_fils(cellule,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,niv+1,niveauatteindre,7);
882  }
883  else {cellule->feuille=1;lst_entite_feuille.ajouter(cellule);}
884  return cellule;
885  }
886 
887 
888 virtual void rechercher(double xcentre,double ycentre,double zcentre,double rayon_recherche,TPL_MAP_ENTITE<A>& liste_entite_trouve)
889 {
890 BOITE_3D boite(xcentre-rayon_recherche,ycentre-rayon_recherche,zcentre-rayon_recherche,xcentre+rayon_recherche,ycentre+rayon_recherche,zcentre+rayon_recherche);
892 rechercher(boite,liste_entite_trouve,cellule);
893 };
894 
895 
896 
897 virtual void inserer(BOITE_3D& boite,A a,TPL_CELLULE_OCTREE<A ,CONDITION>* cellule)
898 {
899 if (cellule==NULL) return;
900 if (boite*cellule->boite)
901  if (cellule->feuille==1)
902  {
903  cellule->lst_entite_A.ajouter(a);
904  }
905 else
906  {
907  inserer(boite,a,cellule->fils[0]);
908  inserer(boite,a,cellule->fils[1]);
909  inserer(boite,a,cellule->fils[2]);
910  inserer(boite,a,cellule->fils[3]);
911  inserer(boite,a,cellule->fils[4]);
912  inserer(boite,a,cellule->fils[5]);
913  inserer(boite,a,cellule->fils[6]);
914  inserer(boite,a,cellule->fils[7]);
915  }
916 };
917 
918 virtual void supprimer(BOITE_3D& boite,A a,TPL_CELLULE_OCTREE<A ,CONDITION>* cellule)
919 {
920 if (cellule==NULL) return;
921 if (boite*cellule->boite)
922  if (cellule->feuille==1)
923  {
924  cellule->lst_entite_A.supprimer(a);
925  }
926 else
927  {
928  supprimer(boite,a,cellule->fils[0]);
929  supprimer(boite,a,cellule->fils[1]);
930  supprimer(boite,a,cellule->fils[2]);
931  supprimer(boite,a,cellule->fils[3]);
932  supprimer(boite,a,cellule->fils[4]);
933  supprimer(boite,a,cellule->fils[5]);
934  supprimer(boite,a,cellule->fils[6]);
935  supprimer(boite,a,cellule->fils[7]);
936  }
937 };
938 
939 virtual void inserer(A a)
940 {
941 BOITE_3D boite=a->get_boite_3D();
943 inserer(boite,a,cellule);
944 }
945 
946 virtual void supprimer(A a)
947 {
948 BOITE_3D boite=a->get_boite_3D();
950 supprimer(boite,a,cellule);
951 }
952 
954 {
955 for (int i=0;i<lst_entite_feuille.get_nb();i++)
956  {
958  for (int j=0;j<cellule->lst_entite_A.get_nb();j++)
959  lst.ajouter(cellule->lst_entite_A.get(j));
960  }
961 return lst.get_nb();
962 }
963 
964 
965 
966 virtual int get_niveau_max(void)
967 {
968 return niveaumax;
969 }
970 
971 virtual int get_niveau_max_lim(void)
972 {
973 return niveaumaxlim;
974 }
975 
976 
978 {
979 niveaumaxlim=num;
980 }
981 
982 virtual void vide(void)
983 {
984 for (int i=0;i<lst_entite_feuille.get_nb();i++)
985  {
987  cellule->vide();
988  }
989 }
990 
991 
993 {
995 double x=cellule->boite.get_xmin();
996 double y=cellule->boite.get_ymin();
997 double z=cellule->boite.get_zmin();
998 double xx=cellule->boite.get_xmax();
999 double yy=cellule->boite.get_ymax();
1000 double zz=cellule->boite.get_zmax();
1001 return sqrt((xx-x)*(xx-x)+(yy-y)*(yy-y)+(zz-z)*(zz-z)) ;
1002 }
1003 
1004 
1005 
1006 protected:
1011 
1012 };
1013 
1014 template <class A,class B>
1015 class TPL_OCTREE_FCT:public TPL_OCTREE<A,A>
1016 {
1017 private:
1018 double coef;
1019 
1020 public:
1022 virtual ~TPL_OCTREE_FCT() {}
1023 
1024 
1025 virtual void change_coefficent_multiplicateur(double val) {coef=val;};
1026 
1027 virtual void initialiser(B &fonction,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
1028  {
1029  TPL_CELLULE_OCTREE<A ,A>* root_cellule=new TPL_CELLULE_OCTREE<A ,A>(NULL,xmin,ymin,zmin,xmax,ymax,zmax,0,-1);
1030  TPL_OCTREE<A,A>::lst_entite_cellule.ajouter(root_cellule);
1031  double dx=root_cellule->boite.get_xmax()-root_cellule->boite.get_xmin();
1032  double dy=root_cellule->boite.get_ymax()-root_cellule->boite.get_ymin();
1033  double dz=root_cellule->boite.get_zmax()-root_cellule->boite.get_zmin();
1034  double d=dx;
1035  if (dy>d) d=dy;
1036  if (dz>d) d=dz;
1037  double xyz[3];
1038  root_cellule->boite.get_centre(xyz);
1039  double ecart[9];
1040  fonction.evaluer(xyz,ecart);
1041  double dcible=coef/sqrt(ecart[0]);
1042  if (dcible<d)
1043  {
1044  root_cellule->feuille=0;
1045  root_cellule->fils[0]=cree_fils(root_cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,fonction,1,0);
1046  root_cellule->fils[1]=cree_fils(root_cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,fonction,1,1);
1047  root_cellule->fils[2]=cree_fils(root_cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,fonction,1,2);
1048  root_cellule->fils[3]=cree_fils(root_cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,fonction,1,3);
1049  root_cellule->fils[4]=cree_fils(root_cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,1,4);
1050  root_cellule->fils[5]=cree_fils(root_cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,1,5);
1051  root_cellule->fils[6]=cree_fils(root_cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,1,6);
1052  root_cellule->fils[7]=cree_fils(root_cellule,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,1,7);
1053  }
1054  else {root_cellule->feuille=1;TPL_OCTREE<A,A>::lst_entite_feuille.ajouter(root_cellule);}
1055  }
1056 
1057 virtual TPL_CELLULE_OCTREE<A ,A>* cree_fils(TPL_CELLULE_OCTREE<A ,A>* cell,double xmin,double ymin,double zmin,double dx,double dy,double dz,B &fonction,int niv,int st)
1058  {
1059  TPL_CELLULE_OCTREE<A ,A>* cellule=new TPL_CELLULE_OCTREE<A ,A>(cell,xmin,ymin,zmin,xmin+dx,ymin+dy,zmin+dz,niv,st);
1060  TPL_OCTREE<A,A>::lst_entite_cellule.ajouter(cellule);
1062  double ddx=cellule->boite.get_xmax()-cellule->boite.get_xmin();
1063  double ddy=cellule->boite.get_ymax()-cellule->boite.get_ymin();
1064  double ddz=cellule->boite.get_zmax()-cellule->boite.get_zmin();
1065  double d=dx;
1066  if (ddy>d) d=ddy;
1067  if (ddz>d) d=ddz;
1068  double xyz[3];
1069  cellule->boite.get_centre(xyz);
1070  double ecart[9];
1071  fonction.evaluer(xyz,ecart);
1072  double dcible=coef/sqrt(ecart[0]);
1073  if (dcible<d)
1074  {
1075  cellule->feuille=0;
1076  cellule->fils[0]=cree_fils(cellule,xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,fonction,niv+1,0);
1077  cellule->fils[1]=cree_fils(cellule,xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,fonction,niv+1,1);
1078  cellule->fils[2]=cree_fils(cellule,xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,fonction,niv+1,2);
1079  cellule->fils[3]=cree_fils(cellule,xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,fonction,niv+1,3);
1080  cellule->fils[4]=cree_fils(cellule,xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,niv+1,4);
1081  cellule->fils[5]=cree_fils(cellule,xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,niv+1,5);
1082  cellule->fils[6]=cree_fils(cellule,xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,niv+1,6);
1083  cellule->fils[7]=cree_fils(cellule,xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,fonction,niv+1,7);
1084  }
1085  else {cellule->feuille=1;TPL_OCTREE<A,A>::lst_entite_feuille.ajouter(cellule);}
1086  return cellule;
1087  }
1088 };
1089 
1090 
1091 template <class A,class B>
1092 class TPL_NTREE_FCT:public TPL_OCTREE<A,A>
1093 {
1094 private:
1095 double coef;
1096 
1097 public:
1099 virtual ~TPL_NTREE_FCT() {}
1100 
1101 
1102 virtual void change_coefficent_multiplicateur(double val) {coef=val;};
1103 
1104 virtual void initialiser(B &fonction,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
1105  {
1106  TPL_CELLULE_OCTREE<A ,A>* root_cellule=new TPL_CELLULE_OCTREE<A ,A>(NULL,xmin,ymin,zmin,xmax,ymax,zmax,0,-1);
1107  TPL_OCTREE<A,A>::lst_entite_cellule.ajouter(root_cellule);
1108  double dx=root_cellule->boite.get_xmax()-root_cellule->boite.get_xmin();
1109  double dy=root_cellule->boite.get_ymax()-root_cellule->boite.get_ymin();
1110  double dz=root_cellule->boite.get_zmax()-root_cellule->boite.get_zmin();
1111  double xyz[3];
1112  root_cellule->boite.get_centre(xyz);
1113  double ecart[9];
1114  fonction.evaluer(xyz,ecart);
1115  double dcible=coef/sqrt(ecart[0]);
1116  int ndivx=2,ndivy=2,ndivz=2;
1117  if (dcible>dx) ndivx=1;
1118  if (dcible>dy) ndivy=1;
1119  if (dcible>dz) ndivz=1;
1120  if (ndivx*ndivy*ndivz!=1)
1121  {
1122  root_cellule->feuille=0;
1123  for (int i=0;i<ndivx;i++)
1124  for (int j=0;j<ndivy;j++)
1125  for (int k=0;k<ndivz;k++)
1126  root_cellule->fils[((i*ndivx)+j)*ndivy+k]=cree_fils(root_cellule,xmin+i*1.0/ndivx*dx,ymin+j*1.0/ndivy*dy,zmin+k*1.0/ndivz*dz,dx*1./ndivx,dy*1./ndivy,dz*1./ndivz,fonction,1,0);
1127  }
1128  else {root_cellule->feuille=1;TPL_OCTREE<A,A>::lst_entite_feuille.ajouter(root_cellule);}
1129  }
1130 
1131 virtual TPL_CELLULE_OCTREE<A ,A>* cree_fils(TPL_CELLULE_OCTREE<A ,A>* cell,double xmin,double ymin,double zmin,double dx,double dy,double dz,B &fonction,int niv,int st)
1132  {
1133  TPL_CELLULE_OCTREE<A ,A>* cellule=new TPL_CELLULE_OCTREE<A ,A>(cell,xmin,ymin,zmin,xmin+dx,ymin+dy,zmin+dz,niv,st);
1134  TPL_OCTREE<A,A>::lst_entite_cellule.ajouter(cellule);
1136  double ddx=cellule->boite.get_xmax()-cellule->boite.get_xmin();
1137  double ddy=cellule->boite.get_ymax()-cellule->boite.get_ymin();
1138  double ddz=cellule->boite.get_zmax()-cellule->boite.get_zmin();
1139  double xyz[3];
1140  cellule->boite.get_centre(xyz);
1141  double ecart[9];
1142  fonction.evaluer(xyz,ecart);
1143  double dcible=coef/sqrt(ecart[0]);
1144  int ndivx=2,ndivy=2,ndivz=2;
1145  if (dcible>dx) ndivx=1;
1146  if (dcible>dy) ndivy=1;
1147  if (dcible>dz) ndivz=1;
1148  if (ndivx*ndivy*ndivz!=1)
1149  {
1150  cellule->feuille=0;
1151  for (int i=0;i<ndivx;i++)
1152  for (int j=0;j<ndivy;j++)
1153  for (int k=0;k<ndivz;k++)
1154  cellule->fils[((i*ndivx)+j)*ndivy+k]=cree_fils(cellule,xmin+i*1.0/ndivx*dx,ymin+j*1.0/ndivy*dy,zmin+k*1.0/ndivz*dz,dx*1./ndivx,dy*1./ndivy,dz*1./ndivz,fonction,1,0);
1155  }
1156  else {cellule->feuille=1;TPL_OCTREE<A,A>::lst_entite_feuille.ajouter(cellule);}
1157  return cellule;
1158  }
1159 };
1160 
1161 
1162 
1163 
1164 
1165 
1166 
1167 
1168 
1169  template <class A,class CONDITION,class B>
1171 {
1172 public:
1175 {
1176  for (int i1=0;i1<lst_entite_cellule.get_nb();i1++)
1177  {
1179  delete cellule;
1180  }
1181 };
1182 
1183 virtual int get_nb_cellule(void) {return lst_entite_cellule.get_nb();};
1184 
1185 virtual BOITE_3D get_boite_de_base(void) {return lst_entite_cellule.get(0)->get_boite();};
1186 
1188 
1189 
1190 virtual void initialiser(TPL_LISTE_ENTITE<CONDITION>* lst_entite,int nombre,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
1191  {
1192  TPL_CELLULE_INFO<A ,CONDITION,B>* root_cellule=new TPL_CELLULE_INFO<A ,CONDITION,B>(xmin,ymin,zmin,xmax,ymax,zmax);
1193  lst_entite_cellule.ajouter(root_cellule);
1194  for (int i=0;i<lst_entite->get_nb();i++)
1195  {
1196  CONDITION cond=lst_entite->get(i);
1197  BOITE_3D boite_cond=cond->get_boite_3D();
1198  if (boite_cond*root_cellule->boite) root_cellule->lst_entite_CONDITION.ajouter(cond);
1199  }
1200  if (root_cellule->lst_entite_CONDITION.get_nb()>nombre)
1201  {
1202  root_cellule->feuille=0;
1203  double dx=xmax-xmin;
1204  double dy=ymax-ymin;
1205  double dz=zmax-zmin;
1206  root_cellule->fils[0]=cree_fils(xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1207  root_cellule->fils[1]=cree_fils(xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1208  root_cellule->fils[2]=cree_fils(xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1209  root_cellule->fils[3]=cree_fils(xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1210  root_cellule->fils[4]=cree_fils(xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1211  root_cellule->fils[5]=cree_fils(xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1212  root_cellule->fils[6]=cree_fils(xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1213  root_cellule->fils[7]=cree_fils(xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1214  }
1215  else root_cellule->feuille=1;
1216  for (int j=0;j<lst_entite_cellule.get_nb();j++)
1217  {
1219  cellule->lst_entite_CONDITION.vide();
1220  }
1221  }
1222 
1223 virtual void initialiser(TPL_MAP_ENTITE<CONDITION>* lst_entite,int nombre,double xmin,double ymin,double zmin,double xmax,double ymax,double zmax)
1224  {
1225  TPL_CELLULE_INFO<A ,CONDITION,B>* root_cellule=new TPL_CELLULE_INFO<A ,CONDITION,B>(xmin,ymin,zmin,xmax,ymax,zmax);
1226  lst_entite_cellule.ajouter(root_cellule);
1227  for (int i=0;i<lst_entite->get_nb();i++)
1228  {
1229  CONDITION cond=lst_entite->get(i);
1230  BOITE_3D boite_cond=cond->get_boite_3D();
1231  if (boite_cond*root_cellule->boite) root_cellule->lst_entite_CONDITION.ajouter(cond);
1232  }
1233  if (root_cellule->lst_entite_CONDITION.get_nb()>nombre)
1234  {
1235  root_cellule->feuille=0;
1236  double dx=xmax-xmin;
1237  double dy=ymax-ymin;
1238  double dz=zmax-zmin;
1239  root_cellule->fils[0]=cree_fils(xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1240  root_cellule->fils[1]=cree_fils(xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1241  root_cellule->fils[2]=cree_fils(xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1242  root_cellule->fils[3]=cree_fils(xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1243  root_cellule->fils[4]=cree_fils(xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1244  root_cellule->fils[5]=cree_fils(xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1245  root_cellule->fils[6]=cree_fils(xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1246  root_cellule->fils[7]=cree_fils(xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(root_cellule->lst_entite_CONDITION),nombre);
1247  }
1248  else root_cellule->feuille=1;
1249  for (int j=0;j<lst_entite_cellule.get_nb();j++)
1250  {
1252  cellule->lst_entite_CONDITION.vide();
1253  }
1254  }
1255 
1256 virtual void initialiser(OCTREE_BASE* oc)
1257 {
1258  BOITE_3D boite=oc->get_cellule(0)->get_boite();
1259  double xmin=boite.get_xmin();
1260  double xmax=boite.get_xmax();
1261  double ymin=boite.get_ymin();
1262  double ymax=boite.get_ymax();
1263  double zmin=boite.get_zmin();
1264  double zmax=boite.get_zmax();
1265  TPL_CELLULE_INFO<A ,CONDITION,B>* cellule=new TPL_CELLULE_INFO<A ,CONDITION,B>(xmin,ymin,zmin,xmax,ymax,zmax);
1266  lst_entite_cellule.ajouter(cellule);
1267  if (oc->get_cellule(0)->get_feuille()==0)
1268  {
1269  cellule->fils[0]=cree_fils(oc->get_cellule(0)->get_fils(0));
1270  cellule->fils[1]=cree_fils(oc->get_cellule(0)->get_fils(1));
1271  cellule->fils[2]=cree_fils(oc->get_cellule(0)->get_fils(2));
1272  cellule->fils[3]=cree_fils(oc->get_cellule(0)->get_fils(3));
1273  cellule->fils[4]=cree_fils(oc->get_cellule(0)->get_fils(4));
1274  cellule->fils[5]=cree_fils(oc->get_cellule(0)->get_fils(5));
1275  cellule->fils[6]=cree_fils(oc->get_cellule(0)->get_fils(6));
1276  cellule->fils[7]=cree_fils(oc->get_cellule(0)->get_fils(7));
1277  }
1278  cellule->feuille=oc->get_cellule(0)->get_feuille();
1279 };
1280 
1281 
1283 {
1284  BOITE_3D boite=cellule_base->get_boite();
1285  double xmin=boite.get_xmin();
1286  double xmax=boite.get_xmax();
1287  double ymin=boite.get_ymin();
1288  double ymax=boite.get_ymax();
1289  double zmin=boite.get_zmin();
1290  double zmax=boite.get_zmax();
1291  TPL_CELLULE_INFO<A ,CONDITION,B>* cellule=new TPL_CELLULE_INFO<A ,CONDITION,B>(xmin,ymin,zmin,xmax,ymax,zmax);
1292  lst_entite_cellule.ajouter(cellule);
1293  if (cellule_base->get_feuille()==1)
1294  {
1295  cellule->feuille=1;
1296  }
1297  else
1298  {
1299  cellule->fils[0]=cree_fils(cellule_base->get_fils(0));
1300  cellule->fils[1]=cree_fils(cellule_base->get_fils(1));
1301  cellule->fils[2]=cree_fils(cellule_base->get_fils(2));
1302  cellule->fils[3]=cree_fils(cellule_base->get_fils(3));
1303  cellule->fils[4]=cree_fils(cellule_base->get_fils(4));
1304  cellule->fils[5]=cree_fils(cellule_base->get_fils(5));
1305  cellule->fils[6]=cree_fils(cellule_base->get_fils(6));
1306  cellule->fils[7]=cree_fils(cellule_base->get_fils(7));
1307  cellule->feuille=0;
1308  }
1309 return cellule;
1310 };
1311 
1312 virtual TPL_CELLULE_INFO<A ,CONDITION,B>* cree_fils(double xmin,double ymin,double zmin,double dx,double dy,double dz,TPL_LISTE_ENTITE<CONDITION>* lst_entite,int nombre)
1313  {
1314  TPL_CELLULE_INFO<A ,CONDITION,B>* cellule=new TPL_CELLULE_INFO<A ,CONDITION,B>(xmin,ymin,zmin,xmin+dx,ymin+dy,zmin+dz);
1315  lst_entite_cellule.ajouter(cellule);
1316  for (int i=0;i<lst_entite->get_nb();i++)
1317  {
1318  CONDITION cond=lst_entite->get(i);
1319  BOITE_3D boite_cond=cond->get_boite_3D();
1320  if (boite_cond*cellule->boite) cellule->lst_entite_CONDITION.ajouter(cond);
1321  }
1322  if (cellule->lst_entite_CONDITION.get_nb()>nombre)
1323  {
1324  cellule->feuille=0;
1325  cellule->fils[0]=cree_fils(xmin,ymin,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1326  cellule->fils[1]=cree_fils(xmin+dx/2.,ymin,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1327  cellule->fils[2]=cree_fils(xmin,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1328  cellule->fils[3]=cree_fils(xmin+dx/2.,ymin+dy/2.,zmin,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1329  cellule->fils[4]=cree_fils(xmin,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1330  cellule->fils[5]=cree_fils(xmin+dx/2.,ymin,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1331  cellule->fils[6]=cree_fils(xmin,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1332  cellule->fils[7]=cree_fils(xmin+dx/2.,ymin+dy/2.,zmin+dz/2.,dx/2.,dy/2.,dz/2.,&(cellule->lst_entite_CONDITION),nombre);
1333  }
1334  else cellule->feuille=1;
1335  return cellule;
1336  }
1337 
1338 
1339 virtual void rechercher(BOITE_3D& boite,TPL_MAP_ENTITE<A>& liste_entite_trouve,TPL_CELLULE_INFO<A ,CONDITION,B>* cellule)
1340 {
1341 if (boite*cellule->boite)
1342  if (cellule->feuille==1)
1343  {
1344  for (int i=0;i<cellule->lst_entite_A.get_nb();i++)
1345  if (boite*cellule->lst_entite_A.get(i)->get_boite_3D())
1346  liste_entite_trouve.ajouter(cellule->lst_entite_A.get(i));
1347  }
1348 else
1349  {
1350  rechercher(boite,liste_entite_trouve,cellule->fils[0]);
1351  rechercher(boite,liste_entite_trouve,cellule->fils[1]);
1352  rechercher(boite,liste_entite_trouve,cellule->fils[2]);
1353  rechercher(boite,liste_entite_trouve,cellule->fils[3]);
1354  rechercher(boite,liste_entite_trouve,cellule->fils[4]);
1355  rechercher(boite,liste_entite_trouve,cellule->fils[5]);
1356  rechercher(boite,liste_entite_trouve,cellule->fils[6]);
1357  rechercher(boite,liste_entite_trouve,cellule->fils[7]);
1358  }
1359 };
1360 
1361 
1363 {
1364 if (boite*cellule->boite)
1365  if (cellule->feuille==1)
1366  {
1367  liste_entite.ajouter(cellule);
1368  }
1369 else
1370  {
1371  get_cellule(boite,cellule->fils[0],liste_entite);
1372  get_cellule(boite,cellule->fils[1],liste_entite);
1373  get_cellule(boite,cellule->fils[2],liste_entite);
1374  get_cellule(boite,cellule->fils[3],liste_entite);
1375  get_cellule(boite,cellule->fils[4],liste_entite);
1376  get_cellule(boite,cellule->fils[5],liste_entite);
1377  get_cellule(boite,cellule->fils[6],liste_entite);
1378  get_cellule(boite,cellule->fils[7],liste_entite);
1379  }
1380 };
1381 
1382 virtual TPL_CELLULE_INFO<A,CONDITION,B> *get_cellule(double x,double y, double z)
1383 {
1384 BOITE_3D boite(x,y,z,x,y,z);
1387 get_cellule(boite,cellule,liste_cellule);
1388 if (liste_cellule.get_nb()==1) return liste_cellule.get(0);
1389 return NULL;
1390 };
1391 
1392 
1393 virtual void rechercher(double xcentre,double ycentre,double zcentre,double rayon_recherche,TPL_MAP_ENTITE<A>& liste_entite_trouve)
1394 {
1395 BOITE_3D boite(xcentre-rayon_recherche,ycentre-rayon_recherche,zcentre-rayon_recherche,xcentre+rayon_recherche,ycentre+rayon_recherche,zcentre+rayon_recherche);
1397 rechercher(boite,liste_entite_trouve,cellule);
1398 };
1399 
1400 
1401 
1402 virtual void inserer(BOITE_3D& boite,A a,TPL_CELLULE_INFO<A ,CONDITION,B>* cellule)
1403 {
1404 if (boite*cellule->boite)
1405  if (cellule->feuille==1)
1406  {
1407  cellule->lst_entite_A.ajouter(a);
1408  }
1409 else
1410  {
1411  inserer(boite,a,cellule->fils[0]);
1412  inserer(boite,a,cellule->fils[1]);
1413  inserer(boite,a,cellule->fils[2]);
1414  inserer(boite,a,cellule->fils[3]);
1415  inserer(boite,a,cellule->fils[4]);
1416  inserer(boite,a,cellule->fils[5]);
1417  inserer(boite,a,cellule->fils[6]);
1418  inserer(boite,a,cellule->fils[7]);
1419  }
1420 };
1421 
1422 virtual void supprimer(BOITE_3D& boite,A a,TPL_CELLULE_INFO<A ,CONDITION,B>* cellule)
1423 {
1424 if (boite*cellule->boite)
1425  if (cellule->feuille==1)
1426  {
1427  cellule->lst_entite_A.supprimer(a);
1428  }
1429 else
1430  {
1431  supprimer(boite,a,cellule->fils[0]);
1432  supprimer(boite,a,cellule->fils[1]);
1433  supprimer(boite,a,cellule->fils[2]);
1434  supprimer(boite,a,cellule->fils[3]);
1435  supprimer(boite,a,cellule->fils[4]);
1436  supprimer(boite,a,cellule->fils[5]);
1437  supprimer(boite,a,cellule->fils[6]);
1438  supprimer(boite,a,cellule->fils[7]);
1439  }
1440 };
1441 
1442 virtual void inserer(A a)
1443 {
1444 BOITE_3D boite=a->get_boite_3D();
1446 inserer(boite,a,cellule);
1447 }
1448 
1449 virtual void supprimer(A a)
1450 {
1451 BOITE_3D boite=a->get_boite_3D();
1453 supprimer(boite,a,cellule);
1454 }
1455 
1456 
1457 private:
1459 
1460 };
1461 
1462 
1463 
1464 
1465 #endif
TPL_CELLULE_OCTREE::get_feuille
virtual int get_feuille(void)
Definition: tpl_octree.h:283
TPL_OCTREE_INFO::initialiser
virtual void initialiser(TPL_LISTE_ENTITE< CONDITION > *lst_entite, int nombre, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:1190
TPL_MAP_ENTITE::get_premier
virtual X get_premier(ITERATEUR &it)
Definition: tpl_map_entite.h:112
TPL_OCTREE::initialiser
virtual void initialiser(TPL_MAP_ENTITE< CONDITION > *lst_entite, int nombre, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:399
TPL_OCTREE_INFO::get_cellule
virtual TPL_CELLULE_INFO< A, CONDITION, B > * get_cellule(int num)
Definition: tpl_octree.h:1187
TPL_NTREE_FCT::~TPL_NTREE_FCT
virtual ~TPL_NTREE_FCT()
Definition: tpl_octree.h:1099
OUTIL_OCTREE::adjacent
bool adjacent(int direction, int octant)
Definition: tpl_octree.h:69
TPL_NTREE_FCT::TPL_NTREE_FCT
TPL_NTREE_FCT()
Definition: tpl_octree.h:1098
TPL_CELLULE_OCTREE::TPL_CELLULE_OCTREE
TPL_CELLULE_OCTREE(TPL_CELLULE_OCTREE< A, CONDITION > *cell, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, int niv, int st)
Definition: tpl_octree.h:270
TPL_CELLULE_OCTREE::~TPL_CELLULE_OCTREE
virtual ~TPL_CELLULE_OCTREE()
Definition: tpl_octree.h:274
TPL_CELLULE_OCTREE::get_entite
A get_entite(int num)
Definition: tpl_octree.h:298
TPL_OCTREE_FCT::initialiser
virtual void initialiser(B &fonction, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:1027
TPL_CELLULE_OCTREE::pere
TPL_CELLULE_OCTREE< A,CONDITION > * pere
Definition: tpl_octree.h:303
TPL_OCTREE::get_dimension_caracteristique
virtual double get_dimension_caracteristique()
Definition: tpl_octree.h:992
TPL_OCTREE::get_keycode
virtual unsigned long get_keycode(TPL_CELLULE_OCTREE< A, CONDITION > *cellule, int numsommet)
Definition: tpl_octree.h:734
TPL_CELLULE_INFO::feuille
int feuille
Definition: tpl_octree.h:320
TPL_NTREE_FCT::change_coefficent_multiplicateur
virtual void change_coefficent_multiplicateur(double val)
Definition: tpl_octree.h:1102
TPL_OCTREE::get_keycode
virtual unsigned long get_keycode(double x, double y, double z)
Definition: tpl_octree.h:759
TPL_OCTREE::get_niveau_max
virtual int get_niveau_max(void)
Definition: tpl_octree.h:966
TPL_CELLULE_INFO::lst_entite_CONDITION
TPL_LISTE_ENTITE< CONDITION > lst_entite_CONDITION
Definition: tpl_octree.h:322
TPL_OCTREE::lst_entite_feuille
TPL_LISTE_ENTITE< TPL_CELLULE_OCTREE< A,CONDITION > * > lst_entite_feuille
Definition: tpl_octree.h:1008
CELLULE_OCTREE_BASE::~CELLULE_OCTREE_BASE
virtual ~CELLULE_OCTREE_BASE()
Definition: tpl_octree.h:244
TPL_MAP_ENTITE
Definition: tpl_map_entite.h:35
TPL_NTREE_FCT::coef
double coef
Definition: tpl_octree.h:1095
BOITE_3D::get_xmin
double get_xmin(void)
Definition: ot_boite_3d.cpp:104
TPL_OCTREE_INFO::~TPL_OCTREE_INFO
virtual ~TPL_OCTREE_INFO()
Definition: tpl_octree.h:1174
TPL_OCTREE_INFO::initialiser
virtual void initialiser(TPL_MAP_ENTITE< CONDITION > *lst_entite, int nombre, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:1223
TPL_CELLULE_INFO::lst_entite_A
TPL_LISTE_ENTITE< A > lst_entite_A
Definition: tpl_octree.h:323
TPL_OCTREE::inserer
virtual void inserer(A a)
Definition: tpl_octree.h:939
TPL_OCTREE::get_niveau_max_lim
virtual int get_niveau_max_lim(void)
Definition: tpl_octree.h:971
TPL_OCTREE::get_nb_feuille
virtual int get_nb_feuille(void)
Definition: tpl_octree.h:358
CELLULE_OCTREE_BASE::get_boite
virtual BOITE_3D get_boite(void)=0
TPL_OCTREE::get_cellule
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_cellule(int num)
Definition: tpl_octree.h:362
TPL_CELLULE_OCTREE::get_fils
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_fils(int num)
Definition: tpl_octree.h:281
OUTIL_OCTREE::filsvoisin
int filsvoisin(int direction, int numvoisin)
Definition: tpl_octree.h:149
BOITE_3D::get_centre
void get_centre(double *coo)
Definition: ot_boite_3d.cpp:149
TPL_OCTREE_INFO::get_cellule
virtual void get_cellule(BOITE_3D &boite, TPL_CELLULE_INFO< A, CONDITION, B > *cellule, TPL_MAP_ENTITE< TPL_CELLULE_INFO< A, CONDITION, B > * > &liste_entite)
Definition: tpl_octree.h:1362
a
#define a(i, j)
TPL_OCTREE_INFO::cree_fils
virtual TPL_CELLULE_INFO< A,CONDITION, B > * cree_fils(double xmin, double ymin, double zmin, double dx, double dy, double dz, TPL_LISTE_ENTITE< CONDITION > *lst_entite, int nombre)
Definition: tpl_octree.h:1312
TPL_CELLULE_OCTREE::sontype
int sontype
Definition: tpl_octree.h:307
OUTIL_OCTREE::areteface
int areteface(int numface, int numarete)
Definition: tpl_octree.h:201
CELLULE_OCTREE_BASE::id
unsigned long id
Definition: tpl_octree.h:250
OUTIL_OCTREE
Definition: tpl_octree.h:33
OCTREE_BASE::get_cellule
virtual CELLULE_OCTREE_BASE * get_cellule(int num)=0
OCTREE_BASE::get_niveau_max
virtual int get_niveau_max(void)=0
TPL_CELLULE_INFO::boite
BOITE_3D boite
Definition: tpl_octree.h:318
TPL_OCTREE::get_xyzsommet_cellule
virtual void get_xyzsommet_cellule(int numcellule, int numsommet, double &x, double &y, double &z)
Definition: tpl_octree.h:771
TPL_OCTREE::get_xyzsommet_feuille
virtual void get_xyzsommet_feuille(int numcellule, int numsommet, double &x, double &y, double &z)
Definition: tpl_octree.h:789
TPL_OCTREE_INFO::rechercher
virtual void rechercher(BOITE_3D &boite, TPL_MAP_ENTITE< A > &liste_entite_trouve, TPL_CELLULE_INFO< A, CONDITION, B > *cellule)
Definition: tpl_octree.h:1339
TPL_OCTREE::supprimer
virtual void supprimer(BOITE_3D &boite, A a, TPL_CELLULE_OCTREE< A, CONDITION > *cellule)
Definition: tpl_octree.h:918
TPL_OCTREE::rechercher
virtual void rechercher(double xcentre, double ycentre, double zcentre, double rayon_recherche, TPL_MAP_ENTITE< A > &liste_entite_trouve)
Definition: tpl_octree.h:888
TPL_OCTREE::supprimer
virtual void supprimer(A a)
Definition: tpl_octree.h:946
TPL_OCTREE::~TPL_OCTREE
virtual ~TPL_OCTREE()
Definition: tpl_octree.h:348
OUTIL_OCTREE::determine_keycode
unsigned long determine_keycode(int nx, int ny, int nz)
Definition: tpl_octree.h:43
TPL_CELLULE_INFO::fils
TPL_CELLULE_INFO< A,CONDITION, B > * fils[8]
Definition: tpl_octree.h:321
TPL_CELLULE_OCTREE::vide
virtual void vide(void)
Definition: tpl_octree.h:285
TPL_OCTREE::get_cellule_keycode
virtual unsigned long get_cellule_keycode(int numcellule, int numsommet)
Definition: tpl_octree.h:722
TPL_OCTREE::niveaumaxlim
int niveaumaxlim
Definition: tpl_octree.h:1010
TPL_OCTREE::lst_entite_cellule
TPL_LISTE_ENTITE< TPL_CELLULE_OCTREE< A,CONDITION > * > lst_entite_cellule
Definition: tpl_octree.h:1007
TPL_CELLULE_OCTREE::get_pere
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_pere(void)
Definition: tpl_octree.h:282
TPL_NTREE_FCT
Definition: tpl_octree.h:1092
TPL_OCTREE::initialiser2D
virtual void initialiser2D(int dimanepasdecouper, TPL_LISTE_ENTITE< CONDITION > *lst_entite, int nombre, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:432
OUTIL_OCTREE::sommetarete
int sommetarete(int numarete, int numsommet)
Definition: tpl_octree.h:177
TPL_CELLULE_OCTREE::get_nb_entite
int get_nb_entite(void)
Definition: tpl_octree.h:294
CELLULE_OCTREE_BASE::get_id
virtual unsigned long get_id()
Definition: tpl_octree.h:250
CELLULE_OCTREE_BASE
Definition: tpl_octree.h:234
TPL_OCTREE::cree_fils2D
virtual TPL_CELLULE_OCTREE< A,CONDITION > * cree_fils2D(int dimanepasdecouper, TPL_CELLULE_OCTREE< A, CONDITION > *cell, double xmin, double ymin, double zmin, double dx, double dy, double dz, TPL_LISTE_ENTITE< CONDITION > *lst_entite, int nombre, int niv, int st)
Definition: tpl_octree.h:564
CELLULE_OCTREE_BASE::get_feuille
virtual int get_feuille(void)=0
TPL_CELLULE_INFO
Definition: tpl_octree.h:311
TPL_CELLULE_OCTREE::lst_entite_CONDITION
TPL_LISTE_ENTITE< CONDITION > lst_entite_CONDITION
Definition: tpl_octree.h:279
OCTREE_BASE
Definition: tpl_octree.h:255
TPL_OCTREE::inserer
virtual void inserer(BOITE_3D &boite, A a, TPL_CELLULE_OCTREE< A, CONDITION > *cellule)
Definition: tpl_octree.h:897
TPL_OCTREE_FCT
Definition: tpl_octree.h:1015
TPL_OCTREE_INFO::get_cellule
virtual TPL_CELLULE_INFO< A, CONDITION, B > * get_cellule(double x, double y, double z)
Definition: tpl_octree.h:1382
TPL_OCTREE_FCT::change_coefficent_multiplicateur
virtual void change_coefficent_multiplicateur(double val)
Definition: tpl_octree.h:1025
TPL_OCTREE::TPL_OCTREE
TPL_OCTREE()
Definition: tpl_octree.h:347
BOITE_3D::get_zmax
double get_zmax(void)
Definition: ot_boite_3d.cpp:129
BOITE_3D::get_ymin
double get_ymin(void)
Definition: ot_boite_3d.cpp:114
TPL_CELLULE_INFO::get_nb_entite
int get_nb_entite(void)
Definition: tpl_octree.h:327
TPL_CELLULE_OCTREE
Definition: tpl_octree.h:267
TPL_OCTREE::get_feuille_voisins
virtual void get_feuille_voisins(TPL_CELLULE_OCTREE< A, CONDITION > *cellule, int direction, std::vector< TPL_CELLULE_OCTREE< A, CONDITION > * > *lst)
Definition: tpl_octree.h:681
TPL_OCTREE_INFO::supprimer
virtual void supprimer(BOITE_3D &boite, A a, TPL_CELLULE_INFO< A, CONDITION, B > *cellule)
Definition: tpl_octree.h:1422
OUTIL_OCTREE::~OUTIL_OCTREE
~OUTIL_OCTREE()
Definition: tpl_octree.h:39
TPL_OCTREE::cree_fils
virtual TPL_CELLULE_OCTREE< A,CONDITION > * cree_fils(TPL_CELLULE_OCTREE< A, CONDITION > *cell, double xmin, double ymin, double zmin, double dx, double dy, double dz, TPL_LISTE_ENTITE< CONDITION > *lst_entite, int nombre, int niv, int st)
Definition: tpl_octree.h:537
TPL_NTREE_FCT::cree_fils
virtual TPL_CELLULE_OCTREE< A,A > * cree_fils(TPL_CELLULE_OCTREE< A, A > *cell, double xmin, double ymin, double zmin, double dx, double dy, double dz, B &fonction, int niv, int st)
Definition: tpl_octree.h:1131
TPL_OCTREE::get_feuille
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_feuille(int num)
Definition: tpl_octree.h:363
OCTREE_BASE::get_nb_cellule
virtual int get_nb_cellule(void)=0
BOITE_3D::get_xmax
double get_xmax(void)
Definition: ot_boite_3d.cpp:109
OCTREE_BASE::OCTREE_BASE
OCTREE_BASE()
Definition: tpl_octree.h:258
TPL_OCTREE_INFO::TPL_OCTREE_INFO
TPL_OCTREE_INFO()
Definition: tpl_octree.h:1173
TPL_CELLULE_INFO::TPL_CELLULE_INFO
TPL_CELLULE_INFO(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:314
TPL_OCTREE::cree_fils
TPL_CELLULE_OCTREE< A, CONDITION > * cree_fils(TPL_CELLULE_OCTREE< A, CONDITION > *cell, CELLULE_OCTREE_BASE *cellule_base, int st)
Definition: tpl_octree.h:506
TPL_MAP_ENTITE::get_nb
virtual int get_nb(void)
Definition: tpl_map_entite.h:83
TPL_OCTREE::niveaumax
int niveaumax
Definition: tpl_octree.h:1009
OUTIL_OCTREE::faceadjacente
int faceadjacente(int numface, int numarete)
Definition: tpl_octree.h:215
TPL_CELLULE_OCTREE::get_boite
BOITE_3D get_boite(void)
Definition: tpl_octree.h:275
TPL_CELLULE_INFO::get_fils
virtual TPL_CELLULE_INFO< A, CONDITION, B > * get_fils(int num)
Definition: tpl_octree.h:325
TPL_OCTREE::rechercher
virtual void rechercher(BOITE_3D &boite, TPL_MAP_ENTITE< A > &liste_entite_trouve, TPL_CELLULE_OCTREE< A, CONDITION > *cellule)
Definition: tpl_octree.h:606
TPL_OCTREE_INFO::initialiser
virtual void initialiser(OCTREE_BASE *oc)
Definition: tpl_octree.h:1256
TPL_LISTE_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_liste_entite.h:38
tpl_map_entite.h
TPL_MAP_ENTITE::ITERATEUR
std::map< unsigned long, X, std::less< unsigned long > >::iterator ITERATEUR
Definition: tpl_map_entite.h:38
TPL_OCTREE_INFO::rechercher
virtual void rechercher(double xcentre, double ycentre, double zcentre, double rayon_recherche, TPL_MAP_ENTITE< A > &liste_entite_trouve)
Definition: tpl_octree.h:1393
CELLULE_OCTREE_BASE::get_fils
virtual CELLULE_OCTREE_BASE * get_fils(int num)=0
TPL_LISTE_ENTITE::get_nb
virtual int get_nb(void)
Definition: tpl_liste_entite.h:67
OUTIL_OCTREE::commonface
int commonface(int direction, int octant)
Definition: tpl_octree.h:128
TPL_OCTREE_FCT::cree_fils
virtual TPL_CELLULE_OCTREE< A,A > * cree_fils(TPL_CELLULE_OCTREE< A, A > *cell, double xmin, double ymin, double zmin, double dx, double dy, double dz, B &fonction, int niv, int st)
Definition: tpl_octree.h:1057
TPL_CELLULE_OCTREE::boite
BOITE_3D boite
Definition: tpl_octree.h:276
TPL_CELLULE_INFO::get_entite
A get_entite(int num)
Definition: tpl_octree.h:331
TPL_OCTREE_INFO
Definition: tpl_octree.h:1170
TPL_OCTREE_INFO::get_nb_cellule
virtual int get_nb_cellule(void)
Definition: tpl_octree.h:1183
OUTIL_OCTREE::reflect
int reflect(int direction, int octant)
Definition: tpl_octree.h:98
TPL_OCTREE::get_tout_entite
virtual int get_tout_entite(TPL_MAP_ENTITE< A > &lst)
Definition: tpl_octree.h:953
TPL_LISTE_ENTITE::get
virtual X get(int num)
Definition: tpl_liste_entite.h:72
CELLULE_OCTREE_BASE::CELLULE_OCTREE_BASE
CELLULE_OCTREE_BASE()
Definition: tpl_octree.h:237
TPL_CELLULE_OCTREE::get_niveau
int get_niveau(void)
Definition: tpl_octree.h:276
BOITE_3D::get_ymax
double get_ymax(void)
Definition: ot_boite_3d.cpp:119
TPL_OCTREE::equilibre
virtual void equilibre(int niveauequilibre=1)
Definition: tpl_octree.h:809
TPL_CELLULE_INFO::get_info
B get_info(int num)
Definition: tpl_octree.h:336
TPL_OCTREE_INFO::inserer
virtual void inserer(BOITE_3D &boite, A a, TPL_CELLULE_INFO< A, CONDITION, B > *cellule)
Definition: tpl_octree.h:1402
TPL_OCTREE::vide
virtual void vide(void)
Definition: tpl_octree.h:982
TPL_LISTE_ENTITE::vide
virtual void vide(void)
Definition: tpl_liste_entite.h:77
TPL_OCTREE_INFO::supprimer
virtual void supprimer(A a)
Definition: tpl_octree.h:1449
TPL_MAP_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_map_entite.h:55
TPL_OCTREE_FCT::coef
double coef
Definition: tpl_octree.h:1018
BOITE_3D
Definition: ot_boite_3d.h:27
TPL_OCTREE::cree_fils
virtual TPL_CELLULE_OCTREE< A,CONDITION > * cree_fils(TPL_CELLULE_OCTREE< A, CONDITION > *cell, double xmin, double ymin, double zmin, double dx, double dy, double dz, int niv, int niveauatteindre, int st)
Definition: tpl_octree.h:866
TPL_CELLULE_OCTREE::fils
TPL_CELLULE_OCTREE< A,CONDITION > * fils[8]
Definition: tpl_octree.h:301
OUTIL_OCTREE::OUTIL_OCTREE
OUTIL_OCTREE()
Definition: tpl_octree.h:36
sqrt
double2 sqrt(double2 &val)
Definition: ot_doubleprecision.cpp:345
TPL_OCTREE::get_nb_cellule
virtual int get_nb_cellule(void)
Definition: tpl_octree.h:357
TPL_OCTREE::get_cellule_adjacent
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_cellule_adjacent(TPL_CELLULE_OCTREE< A, CONDITION > *cellule, int direction)
Definition: tpl_octree.h:650
TPL_OCTREE_INFO::cree_fils
TPL_CELLULE_INFO< A, CONDITION, B > * cree_fils(CELLULE_OCTREE_BASE *cellule_base)
Definition: tpl_octree.h:1282
TPL_OCTREE_INFO::inserer
virtual void inserer(A a)
Definition: tpl_octree.h:1442
TPL_CELLULE_INFO::tab
B tab[8]
Definition: tpl_octree.h:324
TPL_OCTREE_INFO::get_boite_de_base
virtual BOITE_3D get_boite_de_base(void)
Definition: tpl_octree.h:1185
ot_boite_3d.h
OUTIL_OCTREE::sommetface
int sommetface(int numface, int numsommet)
Definition: tpl_octree.h:163
TPL_CELLULE_OCTREE::get_sontype
int get_sontype(void)
Definition: tpl_octree.h:290
TPL_OCTREE::get_boite_de_base
virtual BOITE_3D get_boite_de_base(void)
Definition: tpl_octree.h:360
TPL_CELLULE_OCTREE::lst_entite_A
TPL_LISTE_ENTITE< A > lst_entite_A
Definition: tpl_octree.h:280
TPL_OCTREE::change_niveau_max_lim
void change_niveau_max_lim(int num)
Definition: tpl_octree.h:977
TPL_CELLULE_INFO::~TPL_CELLULE_INFO
virtual ~TPL_CELLULE_INFO()
Definition: tpl_octree.h:317
TPL_MAP_ENTITE::get
virtual X get(int num)
Definition: tpl_map_entite.h:89
BOITE_3D::get_zmin
double get_zmin(void)
Definition: ot_boite_3d.cpp:124
TPL_OCTREE_FCT::~TPL_OCTREE_FCT
virtual ~TPL_OCTREE_FCT()
Definition: tpl_octree.h:1022
TPL_CELLULE_INFO::get_boite
BOITE_3D get_boite(void)
Definition: tpl_octree.h:318
CELLULE_OCTREE_BASE::get_niveau
virtual int get_niveau(void)=0
TPL_LISTE_ENTITE< CONDITION >
OCTREE_BASE::~OCTREE_BASE
virtual ~OCTREE_BASE()
Definition: tpl_octree.h:259
TPL_CELLULE_OCTREE::feuille
int feuille
Definition: tpl_octree.h:278
TPL_OCTREE_FCT::TPL_OCTREE_FCT
TPL_OCTREE_FCT()
Definition: tpl_octree.h:1021
TPL_OCTREE::get_cellule_voisin
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_cellule_voisin(TPL_CELLULE_OCTREE< A, CONDITION > *cellule, int direction)
Definition: tpl_octree.h:664
TPL_CELLULE_INFO::get_feuille
virtual int get_feuille(void)
Definition: tpl_octree.h:326
CELLULE_OCTREE_BASE::get_sontype
virtual int get_sontype(void)=0
TPL_MAP_ENTITE::get_suivant
virtual X get_suivant(ITERATEUR &it)
Definition: tpl_map_entite.h:120
TPL_LISTE_ENTITE::supprimer
virtual void supprimer(X x)
Definition: tpl_liste_entite.h:42
TPL_NTREE_FCT::initialiser
virtual void initialiser(B &fonction, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:1104
TPL_OCTREE::get_cellule
virtual TPL_CELLULE_OCTREE< A, CONDITION > * get_cellule(double x, double y, double z)
Definition: tpl_octree.h:711
TPL_CELLULE_OCTREE::niveau
int niveau
Definition: tpl_octree.h:306
tpl_liste_entite.h
TPL_OCTREE::initialiser
virtual void initialiser(TPL_LISTE_ENTITE< CONDITION > *lst_entite, int nombre, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: tpl_octree.h:366
TPL_CELLULE_INFO::change_info
void change_info(int num, B val)
Definition: tpl_octree.h:337
TPL_OCTREE
Definition: tpl_octree.h:344
TPL_OCTREE::get_cellule
virtual void get_cellule(BOITE_3D &boite, TPL_CELLULE_OCTREE< A, CONDITION > *cellule, TPL_MAP_ENTITE< TPL_CELLULE_OCTREE< A, CONDITION > * > &liste_entite)
Definition: tpl_octree.h:630
TPL_OCTREE_INFO::lst_entite_cellule
TPL_LISTE_ENTITE< TPL_CELLULE_INFO< A,CONDITION, B > * > lst_entite_cellule
Definition: tpl_octree.h:1458
TPL_OCTREE::initialiser
virtual void initialiser(OCTREE_BASE *oc)
Definition: tpl_octree.h:478
TPL_OCTREE::get_feuille_keycode
virtual unsigned long get_feuille_keycode(int numcellule, int numsommet)
Definition: tpl_octree.h:728