ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/acismesh/geo_app_point_face.cpp
Revision: 1
Committed: Mon Jun 11 22:53:07 2007 UTC (17 years, 11 months ago)
File size: 3173 byte(s)
Log Message:

File Contents

# User Rev Content
1 1 /*****************************************************************
2    
3     geo_app_point_face.cpp Type:Func
4    
5     Appartenance d un point a une face
6    
7     Date de creation : 14-8-1997 15 :39 :35
8     Derniere version : 14-8-1997 15 :39 :35
9    
10     Vincent FRANCOIS
11    
12     *****************************************************************/
13    
14    
15    
16    
17    
18     /**************************/
19     /* include */
20     #include <stdio.h>
21     #include <string.h>
22     #include <stdlib.h>
23     #include <math.h>
24     #include "const.h"
25     #include "memoire.h"
26     #include "struct.h"
27     #include "prototype.h"
28    
29     /**************************/
30     /* variables globales */
31     extern struct environnement env;
32     extern struct s_mesh *mesh;
33     extern struct s_maillage *maillage;
34     extern struct s_acis *acis;
35    
36     int geo_app_point_face(struct s_face *face,struct s_mnoeud *mno)
37     {
38     struct s_cone *cone;
39     struct s_plane *plane;
40     float x,y,z,xtmp,ytmp,ztmp;
41     float terme1,terme2,test;
42     float n[4],vec[4];
43     int rep;
44    
45    
46     cone=NULL;
47     plane=NULL;
48     if (strcmp(acis->type_entite[face->surface],"cone-surface")==0)
49     cone=(struct s_cone *)acis->entity[face->surface];
50     if (strcmp(acis->type_entite[face->surface],"plane-surface")==0)
51     plane=(struct s_plane *)acis->entity[face->surface];
52     x=mno->x;
53     y=mno->y;
54     z=mno->z;
55     if (cone!=NULL)
56     {
57     xtmp=cone->param->u[0]*(x-cone->param->centre[0])+cone->param->u[1]*(y-cone->param->centre[1])+cone->param->u[2]*(z-cone->param->centre[2]);
58     ytmp=cone->param->v[0]*(x-cone->param->centre[0])+cone->param->v[1]*(y-cone->param->centre[1])+cone->param->v[2]*(z-cone->param->centre[2]);
59     ztmp=cone->param->w[0]*(x-cone->param->centre[0])+cone->param->w[1]*(y-cone->param->centre[1])+cone->param->w[2]*(z-cone->param->centre[2]);
60     terme1=cone->param->a*(1.+ztmp*cone->param->tg/cone->param->a);
61     if (EGAL(terme1,0.0,0.0001)) return(0);
62     else terme1=xtmp/terme1;
63     terme2=cone->param->b*(1.+ztmp*cone->param->tg/cone->param->a);
64     if (EGAL(terme2,0.0,0.0001)) return(0);
65     else terme2=ytmp/terme2;
66     test=terme1*terme1+terme2*terme2;
67     if (EGAL(test,1.,0.0001))
68     {
69     eval_cone(face,cone->param,&mno->u,&mno->v,INVERSE,&x,&y,&z,0.);
70     rep=1;
71     }
72     else rep=0;
73     }
74     if (plane!=NULL)
75     {
76     PVEC(n,plane->param->dir1,plane->param->dir2);
77     vec[0]=plane->param->root[0]-mno->x;
78     vec[1]=plane->param->root[1]-mno->y;
79     vec[2]=plane->param->root[2]-mno->z;
80     NORME(n);
81     NORME(vec);
82     test=PSCA(n,vec);
83     if (EGAL(test,0.,0.0001))
84     {
85     eval_plane(face,plane->param,&mno->u,&mno->v,INVERSE,&x,&y,&z);
86     rep=1;
87     }
88     else rep=0;
89     }
90     return(rep);
91     }