1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
eval_fdn1_eps.c Type:Func
|
4 |
|
|
|
5 |
|
|
Calcul de la fonction de densite pour approcher une courbe a epsilon
|
6 |
|
|
|
7 |
|
|
Date de creation : Thu Nov 28 18:50:42 1996
|
8 |
|
|
|
9 |
|
|
Derniere version : Tue Jun 3 13:32:09 1997
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
Vincent FRANCOIS
|
19 |
|
|
|
20 |
|
|
*****************************************************************/
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
/**************************/
|
27 |
|
|
/* include */
|
28 |
|
|
#include <stdio.h>
|
29 |
|
|
#include <string.h>
|
30 |
|
|
#include <math.h>
|
31 |
|
|
#include "const.h"
|
32 |
|
|
#include "struct.h"
|
33 |
|
|
#include "prototype.h"
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/**************************/
|
37 |
|
|
/* variables globales */
|
38 |
|
|
extern struct s_param *para;
|
39 |
|
|
extern struct environnement env;
|
40 |
|
|
extern struct s_acis *acis;
|
41 |
|
|
|
42 |
|
|
/**************************/
|
43 |
|
|
/* programme principal */
|
44 |
|
|
|
45 |
|
|
float eval_fdn1_eps(struct s_edge *edge,float t)
|
46 |
|
|
{
|
47 |
|
|
struct s_straight *straight;
|
48 |
|
|
float dens,m[4],facteur1,facteur2;
|
49 |
|
|
float coord[3],coord2[3],vec[4];
|
50 |
|
|
|
51 |
|
|
if (strcmp(acis->type_entite[edge->curve],"straight-curve")==0)
|
52 |
|
|
{
|
53 |
|
|
straight=(struct s_straight *)acis->entity[edge->curve];
|
54 |
|
|
memcpy(vec,straight->param->dir,3*sizeof(float));
|
55 |
|
|
vec[0]=vec[0]*edge->t2;
|
56 |
|
|
vec[1]=vec[1]*edge->t2;
|
57 |
|
|
vec[2]=vec[2]*edge->t2;
|
58 |
|
|
NORME(vec);
|
59 |
|
|
return(vec[3]*10000.);
|
60 |
|
|
}
|
61 |
|
|
eval_edge(edge,t,DERIVE_SECONDE,coord2);
|
62 |
|
|
eval_edge(edge,t,DERIVE,coord);
|
63 |
|
|
facteur1=(coord[0]*coord[0]+coord[1]*coord[1]+coord[2]*coord[2]);
|
64 |
|
|
facteur2=(coord2[0]*coord[0]+coord2[1]*coord[1]+coord2[2]*coord[2])/facteur1/facteur1/2.;
|
65 |
|
|
m[0]=coord2[0]/facteur1-coord[0]*facteur2;
|
66 |
|
|
m[1]=coord2[1]/facteur1-coord[1]*facteur2;
|
67 |
|
|
m[2]=coord2[2]/facteur1-coord[2]*facteur2;
|
68 |
|
|
NORME(m);
|
69 |
|
|
if (env.relatif==0) dens=8.*env.epsilon/m[3];
|
70 |
|
|
else dens=8.*env.epsilon/m[3]/m[3];
|
71 |
|
|
dens=(float)sqrt((double)dens);
|
72 |
|
|
return(dens);
|
73 |
|
|
}
|