| 1 |
|
1 |
/*****************************************************************
|
| 2 |
|
|
|
| 3 |
|
|
eval_dis_point_face.cpp Type:Func
|
| 4 |
|
|
|
| 5 |
|
|
Calcul la distance d'un point de l'espace a un point d'une entite
|
| 6 |
|
|
|
| 7 |
|
|
Date de creation : 2-2-1999 10 :11 :13
|
| 8 |
|
|
Derniere version : 2-2-1999 10 :11 :13
|
| 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 "struct.h"
|
| 24 |
|
|
#include "const.h"
|
| 25 |
|
|
#include "prototype.h"
|
| 26 |
|
|
|
| 27 |
|
|
/**************************/
|
| 28 |
|
|
/* variables globales */
|
| 29 |
|
|
extern struct s_acis *acis;
|
| 30 |
|
|
|
| 31 |
|
|
|
| 32 |
|
|
|
| 33 |
|
|
/**************************/
|
| 34 |
|
|
/* programme principal */
|
| 35 |
|
|
|
| 36 |
|
|
float eval_dis_point_face(struct s_face *face,float *x,float u,float v,int type)
|
| 37 |
|
|
{
|
| 38 |
|
|
float res;
|
| 39 |
|
|
float xx[4],xu[4];
|
| 40 |
|
|
|
| 41 |
|
|
|
| 42 |
|
|
|
| 43 |
|
|
if (type==FONCTION)
|
| 44 |
|
|
{
|
| 45 |
|
|
eval_face(face,&u,&v,FONCTION,&xx[0],&xx[1],&xx[2],0.,0.);
|
| 46 |
|
|
res=(x[0]-xx[0])*(x[0]-xx[0])+(x[1]-xx[1])*(x[1]-xx[1])+(x[2]-xx[2])*(x[2]-xx[2]);
|
| 47 |
|
|
}
|
| 48 |
|
|
if (type==DU)
|
| 49 |
|
|
{
|
| 50 |
|
|
eval_face(face,&u,&v,FONCTION,&xx[0],&xx[1],&xx[2],0.,0.);
|
| 51 |
|
|
eval_face(face,&u,&v,DU,&xu[0],&xu[1],&xu[2],0.,0.);
|
| 52 |
|
|
res=(x[0]-xx[0])*xu[0]+(x[1]-xx[1])*xu[1]+(x[2]-xx[2])*xu[2];
|
| 53 |
|
|
res=res*(-2);
|
| 54 |
|
|
}
|
| 55 |
|
|
if (type==DV)
|
| 56 |
|
|
{
|
| 57 |
|
|
eval_face(face,&u,&v,FONCTION,&xx[0],&xx[1],&xx[2],0.,0.);
|
| 58 |
|
|
eval_face(face,&u,&v,DV,&xu[0],&xu[1],&xu[2],0.,0.);
|
| 59 |
|
|
res=(x[0]-xx[0])*xu[0]+(x[1]-xx[1])*xu[1]+(x[2]-xx[2])*xu[2];
|
| 60 |
|
|
res=res*(-2);
|
| 61 |
|
|
}
|
| 62 |
|
|
return(res);
|
| 63 |
|
|
}
|