1 |
/*****************************************************************
|
2 |
|
3 |
oc_rechercher.c Type:Func
|
4 |
|
5 |
Recherche de cases dans la liste d octree
|
6 |
|
7 |
Date de creation : Mon Jun 30 09:44:09 1997
|
8 |
|
9 |
Derniere version : Mon Jun 30 09:44:09 1997
|
10 |
|
11 |
|
12 |
Vincent FRANCOIS
|
13 |
|
14 |
*****************************************************************/
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
/**************************/
|
21 |
/* include */
|
22 |
#include <stdio.h>
|
23 |
#include <string.h>
|
24 |
#include "const.h"
|
25 |
#include "memoire.h"
|
26 |
#include "struct.h"
|
27 |
#include "prototype.h"
|
28 |
|
29 |
/**************************/
|
30 |
/* variables globales */
|
31 |
|
32 |
|
33 |
|
34 |
/**************************/
|
35 |
/* programme principal */
|
36 |
|
37 |
void oc_rechercher(float x,float y,float z,float rayon,struct s_octree *oc,struct s_octree **liste,int *nb_liste)
|
38 |
{
|
39 |
|
40 |
|
41 |
if (x+rayon>=oc->x)
|
42 |
if (y+rayon>=oc->y)
|
43 |
if (z+rayon>=oc->z)
|
44 |
if (x-rayon<oc->x+oc->taille)
|
45 |
if (y-rayon<oc->y+oc->taille)
|
46 |
if (z-rayon<oc->z+oc->taille)
|
47 |
if (oc->feuille==1)
|
48 |
{
|
49 |
liste[*nb_liste]=oc;
|
50 |
(*nb_liste)++;
|
51 |
}
|
52 |
else
|
53 |
{
|
54 |
oc_rechercher(x,y,z,rayon,oc->fils[0],liste,nb_liste);
|
55 |
oc_rechercher(x,y,z,rayon,oc->fils[1],liste,nb_liste);
|
56 |
oc_rechercher(x,y,z,rayon,oc->fils[2],liste,nb_liste);
|
57 |
oc_rechercher(x,y,z,rayon,oc->fils[3],liste,nb_liste);
|
58 |
oc_rechercher(x,y,z,rayon,oc->fils[4],liste,nb_liste);
|
59 |
oc_rechercher(x,y,z,rayon,oc->fils[5],liste,nb_liste);
|
60 |
oc_rechercher(x,y,z,rayon,oc->fils[6],liste,nb_liste);
|
61 |
oc_rechercher(x,y,z,rayon,oc->fils[7],liste,nb_liste);
|
62 |
}
|
63 |
|
64 |
|
65 |
|
66 |
}
|