1 |
/*****************************************************************
|
2 |
|
3 |
r3d_comp_detruit2.cpp Type:Func
|
4 |
|
5 |
Destruction autour d un point
|
6 |
|
7 |
Date de creation : 16-9-1997 10 :26 :38
|
8 |
Derniere version : 16-9-1997 10 :26 :38
|
9 |
|
10 |
Vincent FRANCOIS
|
11 |
|
12 |
*****************************************************************/
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
/**************************/
|
19 |
/* include */
|
20 |
#include <stdio.h>
|
21 |
#include <string.h>
|
22 |
#include <math.h>
|
23 |
#include "const.h"
|
24 |
#include "memoire.h"
|
25 |
#include "struct.h"
|
26 |
#include "prototype.h"
|
27 |
|
28 |
/**************************/
|
29 |
/* variables globales */
|
30 |
extern struct s_acis *acis;
|
31 |
extern struct environnement env;
|
32 |
extern struct s_mesh *mesh;
|
33 |
extern struct s_param *para;
|
34 |
|
35 |
|
36 |
|
37 |
/**************************/
|
38 |
/* programme principal */
|
39 |
|
40 |
void r3d_comp_detruit2(struct s_zone *zone,float x,float y,float z,char type_ent,int num_ent,float rayon,float dens,float *norm,struct s_octree **liste)
|
41 |
{
|
42 |
struct s_octree *oct;
|
43 |
struct s_mnoeud *mnoe;
|
44 |
int nb_liste,i,k,test;
|
45 |
float dis,distance,vec[4];
|
46 |
int face1,face2;
|
47 |
|
48 |
nb_liste=0;
|
49 |
dis=env.zone*rayon;
|
50 |
oc_rechercher(x,y,z,dis,mesh->first,liste,&nb_liste);
|
51 |
dis=dis*dis;
|
52 |
if ((type_ent==EDGE)&&(zone->reference==OLD))
|
53 |
{
|
54 |
face1=zone->entite[0];
|
55 |
face2=zone->entite[1];
|
56 |
}
|
57 |
|
58 |
for (i=0;i<nb_liste;i++)
|
59 |
{
|
60 |
oct=liste[i];
|
61 |
for (k=0;k<oct->nb_mnoeud;k++)
|
62 |
{
|
63 |
mnoe=oct->mnoeud[k];
|
64 |
test=0;
|
65 |
if ((zone->reference==NEW)||(zone->reference==VERIFICATION)) test=1;
|
66 |
else
|
67 |
{
|
68 |
if ((type_ent==FACE) && (mnoe->type==FACE) && (mnoe->num_ent==num_ent) ) test=1;
|
69 |
if ((type_ent==EDGE) && (mnoe->type==EDGE) && (mnoe->num_ent==num_ent) ) test=1;
|
70 |
if ((type_ent==EDGE) && (mnoe->type==FACE) && (mnoe->num_ent==face1) ) test=1;
|
71 |
if ((type_ent==EDGE) && (mnoe->type==FACE) && (mnoe->num_ent==face2) ) test=1;
|
72 |
if (type_ent==VERTEX) test=1;
|
73 |
}
|
74 |
if ( (test==1)&&(mnoe->etat==GARDE) )
|
75 |
{
|
76 |
eval_dens_reel(mnoe);
|
77 |
vec[0]=x-mnoe->x;
|
78 |
vec[1]=y-mnoe->y;
|
79 |
vec[2]=z-mnoe->z;
|
80 |
distance=(float)sqrt((double)PSCA(vec,vec));
|
81 |
if ((zone->reference==OLD)||(zone->reference==VERIFICATION)) dis=1.1*dens;
|
82 |
if (zone->reference==NEW)
|
83 |
{
|
84 |
MAXI(dis,2*dens,(float)fabs((double)4.*(dens-mnoe->dens)));
|
85 |
MAXI(dis,dis,2*mnoe->dens);
|
86 |
}
|
87 |
if ((zone->type_entite==FACE)&&(zone->reference==NEW))
|
88 |
{
|
89 |
NORME(vec);
|
90 |
dis=dis*(0.5+0.5*PSCA(norm,vec));
|
91 |
}
|
92 |
if (zone->reference==VERIFICATION)
|
93 |
{
|
94 |
NORME(vec);
|
95 |
dis=dis*(0.5+0.5*PSCA(norm,vec));
|
96 |
}
|
97 |
if (distance<dis*env.zone) mnoe->etat=DETRUIT;
|
98 |
}
|
99 |
}
|
100 |
}
|
101 |
}
|