1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
qu_parcour2.c Type:Func
|
4 |
|
|
|
5 |
|
|
insertion et descente de l arbre
|
6 |
|
|
|
7 |
|
|
Date de creation : Wed Feb 12 17:34:10 1997
|
8 |
|
|
|
9 |
|
|
Derniere version : Tue Apr 22 13:24:44 1997
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
Vincent FRANCOIS
|
16 |
|
|
|
17 |
|
|
*****************************************************************/
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
/**************************/
|
24 |
|
|
/* include */
|
25 |
|
|
#include <stdio.h>
|
26 |
|
|
#include <string.h>
|
27 |
|
|
#include <stdlib.h>
|
28 |
|
|
#include "const.h"
|
29 |
|
|
#include "memoire.h"
|
30 |
|
|
#include "struct.h"
|
31 |
|
|
#include "prototype.h"
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/**************************/
|
35 |
|
|
/* variables globales */
|
36 |
|
|
extern struct environnment env;
|
37 |
|
|
extern struct s_mesh *mesh;
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
/**************************/
|
42 |
|
|
/* programme principal */
|
43 |
|
|
|
44 |
|
|
void qu_parcour2(float bumin,float bvmin,float bumax,float bvmax,struct s_quadtree *quad,int type,int num)
|
45 |
|
|
{
|
46 |
|
|
struct s_noeud *no;
|
47 |
|
|
struct s_segment *seg;
|
48 |
|
|
struct s_triangle *tri;
|
49 |
|
|
struct s_frontiere *fr;
|
50 |
|
|
struct s_front *ft;
|
51 |
|
|
int numo;
|
52 |
|
|
|
53 |
|
|
if (bumax>=quad->u-0.0001)
|
54 |
|
|
if (bvmax>=quad->v-0.0001)
|
55 |
|
|
if (bumin<quad->u+quad->t_u)
|
56 |
|
|
if (bvmin<quad->v+quad->t_v)
|
57 |
|
|
if (quad->feuille==1)
|
58 |
|
|
{
|
59 |
|
|
if (type==NOEUD)
|
60 |
|
|
{
|
61 |
|
|
no=ADRESSE(num,noeud,mesh->);
|
62 |
|
|
NEW_POINTEUR(numo,noeud,quad->);
|
63 |
|
|
quad->noeud[numo]=no;
|
64 |
|
|
}
|
65 |
|
|
if (type==SEGMENT)
|
66 |
|
|
{
|
67 |
|
|
seg=ADRESSE(num,segment,mesh->);
|
68 |
|
|
NEW_POINTEUR(numo,segment,quad->);
|
69 |
|
|
quad->segment[numo]=seg;
|
70 |
|
|
}
|
71 |
|
|
if (type==TRIANGLE)
|
72 |
|
|
{
|
73 |
|
|
tri=ADRESSE(num,triangle,mesh->);
|
74 |
|
|
NEW_POINTEUR(numo,triangle,quad->);
|
75 |
|
|
quad->triangle[numo]=tri;
|
76 |
|
|
}
|
77 |
|
|
if (type==FRONTIERE)
|
78 |
|
|
{
|
79 |
|
|
fr=ADRESSE(num,frontiere,mesh->);
|
80 |
|
|
NEW_POINTEUR(numo,frontiere,quad->);
|
81 |
|
|
quad->frontiere[numo]=fr;
|
82 |
|
|
}
|
83 |
|
|
if (type==FRONT)
|
84 |
|
|
{
|
85 |
|
|
ft=ADRESSE(num,front,mesh->);
|
86 |
|
|
NEW_POINTEUR(numo,front,quad->);
|
87 |
|
|
quad->front[numo]=ft;
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
else
|
91 |
|
|
{
|
92 |
|
|
qu_parcour2(bumin,bvmin,bumax,bvmax,quad->fils[0],type,num);
|
93 |
|
|
qu_parcour2(bumin,bvmin,bumax,bvmax,quad->fils[1],type,num);
|
94 |
|
|
qu_parcour2(bumin,bvmin,bumax,bvmax,quad->fils[2],type,num);
|
95 |
|
|
qu_parcour2(bumin,bvmin,bumax,bvmax,quad->fils[3],type,num);
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
}
|