1 |
/*****************************************************************
|
2 |
|
3 |
m2d_param_plane.c Type:Func
|
4 |
|
5 |
Parametrisation d'un plan
|
6 |
|
7 |
Date de creation : Wed Feb 5 10:25:18 1997
|
8 |
|
9 |
Derniere version : Tue Apr 22 12:25:42 1997
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
Vincent FRANCOIS
|
15 |
|
16 |
*****************************************************************/
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
/**************************/
|
23 |
/* include */
|
24 |
#include <stdio.h>
|
25 |
#include <string.h>
|
26 |
#include <stdlib.h>
|
27 |
#include <math.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 s_acis *acis;
|
37 |
extern struct s_param *para;
|
38 |
extern struct s_mesh *mesh;
|
39 |
|
40 |
|
41 |
|
42 |
/**************************/
|
43 |
/* programme principal */
|
44 |
|
45 |
void m2d_param_plane(struct s_face *face,struct s_plane *plane)
|
46 |
{
|
47 |
float vec[4],dir1[4],dir2[4];
|
48 |
struct s_loop *loop;
|
49 |
struct s_coedge *coedge;
|
50 |
struct s_segment *seg;
|
51 |
struct s_noeud *no1;
|
52 |
int i;
|
53 |
int pass=0;
|
54 |
|
55 |
if (plane->param==NULL)
|
56 |
{
|
57 |
NEW_ENTITE(plane->param,par_plane,para->);
|
58 |
memcpy(vec,plane->normal,3*sizeof(float));
|
59 |
NORME(vec);
|
60 |
if (!(EGAL(vec[0],0.,0.0001)))
|
61 |
{
|
62 |
dir1[0]=(vec[1]);
|
63 |
dir1[1]=(-vec[0]);
|
64 |
dir1[2]=0.;
|
65 |
}
|
66 |
else if (!(EGAL(vec[1],0.,0.0001)))
|
67 |
{
|
68 |
dir1[0]=0.;
|
69 |
dir1[1]=(-vec[2]);
|
70 |
dir1[2]=vec[1];
|
71 |
}
|
72 |
else
|
73 |
{
|
74 |
dir1[0]=vec[2];
|
75 |
dir1[1]=0.;
|
76 |
dir1[2]=0.;
|
77 |
}
|
78 |
NORME(dir1);
|
79 |
PVEC(dir2,vec,dir1);
|
80 |
memcpy(plane->param->dir1,dir1,3*sizeof(float));
|
81 |
memcpy(plane->param->dir2,dir2,3*sizeof(float));
|
82 |
memcpy(plane->param->root,plane->root,3*sizeof(float));
|
83 |
}
|
84 |
|
85 |
|
86 |
/* min max des parametres */
|
87 |
for (loop=face->first_loop;loop!=NULL;loop=loop->next_loop)
|
88 |
{
|
89 |
coedge=loop->first_coedge;
|
90 |
do
|
91 |
{
|
92 |
for (i=0;i<coedge->edge->nb_segment;i++)
|
93 |
{
|
94 |
seg=coedge->edge->segment[i];
|
95 |
no1=ADRESSE(seg->n1,noeud,mesh->);
|
96 |
eval_plane(face,plane->param,&no1->u,&no1->v,INVERSE,&no1->x,&no1->y,&no1->z);
|
97 |
if (pass==0)
|
98 |
{
|
99 |
pass=1;
|
100 |
face->uinf=no1->u;
|
101 |
face->usup=no1->u;
|
102 |
face->vinf=no1->v;
|
103 |
face->vsup=no1->v;
|
104 |
}
|
105 |
if (face->uinf>no1->u) face->uinf=no1->u;
|
106 |
if (face->usup<no1->u) face->usup=no1->u;
|
107 |
if (face->vinf>no1->v) face->vinf=no1->v;
|
108 |
if (face->vsup<no1->v) face->vsup=no1->v;
|
109 |
}
|
110 |
coedge=coedge->next_coedge;
|
111 |
}
|
112 |
while (coedge!=loop->first_coedge);
|
113 |
}
|
114 |
face->rev_u=0.;
|
115 |
face->rev_v=0.;
|
116 |
}
|
117 |
|