1 |
/*****************************************************************
|
2 |
|
3 |
oc_place_boite.c Type:Func
|
4 |
|
5 |
Insertion d une boite dans l arbre
|
6 |
|
7 |
Date de creation : Wed Jun 25 17:46:36 1997
|
8 |
|
9 |
Derniere version : Wed Jul 16 11:10:31 1997
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
Vincent FRANCOIS
|
15 |
|
16 |
*****************************************************************/
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
/**************************/
|
23 |
/* include */
|
24 |
#include <stdio.h>
|
25 |
#include <string.h>
|
26 |
#include <stdlib.h>
|
27 |
#include "const.h"
|
28 |
#include "memoire.h"
|
29 |
#include "struct.h"
|
30 |
#include "prototype.h"
|
31 |
|
32 |
/**************************/
|
33 |
/* variables globales */
|
34 |
extern struct s_acis *acis;
|
35 |
extern struct environnement env;
|
36 |
extern struct s_mesh *mesh;
|
37 |
extern struct s_param *para;
|
38 |
|
39 |
|
40 |
|
41 |
/**************************/
|
42 |
/* programme principal */
|
43 |
|
44 |
void oc_place_boite(int type,void *entite,float bxmin,float bymin,float bzmin,float bxmax,float bymax,float bzmax,struct s_octree *octree)
|
45 |
{
|
46 |
float xx,yy,zz;
|
47 |
int num;
|
48 |
|
49 |
|
50 |
xx=octree->x;
|
51 |
yy=octree->y;
|
52 |
zz=octree->z;
|
53 |
if (bxmax>=xx)
|
54 |
if (bymax>=yy)
|
55 |
if (bzmax>=zz)
|
56 |
if (bxmin<xx+octree->taille)
|
57 |
if (bymin<yy+octree->taille)
|
58 |
if (bzmin<zz+octree->taille)
|
59 |
if (octree->feuille==1)
|
60 |
{
|
61 |
if (type==POINT)
|
62 |
{
|
63 |
NEW_POINTEUR(num,vertex,octree->);
|
64 |
octree->vertex[num]=(struct s_vertex *)entite;
|
65 |
}
|
66 |
if (type==STRAIGHT)
|
67 |
{
|
68 |
NEW_POINTEUR(num,edge,octree->);
|
69 |
octree->edge[num]=(struct s_edge *)entite;
|
70 |
}
|
71 |
if (type==ELLIPSE)
|
72 |
{
|
73 |
NEW_POINTEUR(num,edge,octree->);
|
74 |
octree->edge[num]=(struct s_edge *)entite;
|
75 |
}
|
76 |
if (type==PLANE)
|
77 |
{
|
78 |
NEW_POINTEUR(num,face,octree->);
|
79 |
octree->face[num]=(struct s_face *)entite;
|
80 |
}
|
81 |
if (type==CONE)
|
82 |
{
|
83 |
NEW_POINTEUR(num,face,octree->);
|
84 |
octree->face[num]=(struct s_face *)entite;
|
85 |
}
|
86 |
if (type==NOEUD)
|
87 |
{
|
88 |
NEW_POINTEUR(num,noeud,octree->);
|
89 |
octree->noeud[num]=(struct s_noeud *)entite;
|
90 |
}
|
91 |
if (type==TRIANGLE)
|
92 |
{
|
93 |
NEW_POINTEUR(num,triangle,octree->);
|
94 |
octree->triangle[num]=(struct s_triangle *)entite;
|
95 |
}
|
96 |
if (type==TETRA)
|
97 |
{
|
98 |
NEW_POINTEUR(num,tetra,octree->);
|
99 |
octree->tetra[num]=(struct s_tetra *)entite;
|
100 |
}
|
101 |
if (type==MNOEUD)
|
102 |
{
|
103 |
NEW_POINTEUR(num,mnoeud,octree->);
|
104 |
octree->mnoeud[num]=(struct s_mnoeud *)entite;
|
105 |
}
|
106 |
if (type==MSEGMENT)
|
107 |
{
|
108 |
NEW_POINTEUR(num,msegment,octree->);
|
109 |
octree->msegment[num]=(struct s_msegment *)entite;
|
110 |
}
|
111 |
if (type==MTRIANGLE)
|
112 |
{
|
113 |
NEW_POINTEUR(num,mtriangle,octree->);
|
114 |
octree->mtriangle[num]=(struct s_mtriangle *)entite;
|
115 |
}
|
116 |
if (type==MTETRA)
|
117 |
{
|
118 |
NEW_POINTEUR(num,mtetra,octree->);
|
119 |
octree->mtetra[num]=(struct s_mtetra *)entite;
|
120 |
}
|
121 |
if (type==FRONTIERE3D)
|
122 |
{
|
123 |
NEW_POINTEUR(num,frontiere3d,octree->);
|
124 |
octree->frontiere3d[num]=(struct s_frontiere3d *)entite;
|
125 |
}
|
126 |
if (type==FRONT3D)
|
127 |
{
|
128 |
NEW_POINTEUR(num,front3d,octree->);
|
129 |
octree->front3d[num]=(struct s_front3d *)entite;
|
130 |
}
|
131 |
|
132 |
}
|
133 |
else
|
134 |
{
|
135 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[0]);
|
136 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[1]);
|
137 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[2]);
|
138 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[3]);
|
139 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[4]);
|
140 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[5]);
|
141 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[6]);
|
142 |
oc_place_boite(type,entite,bxmin,bymin,bzmin,bxmax,bymax,bzmax,octree->fils[7]);
|
143 |
}
|
144 |
}
|