1 |
/*****************************************************************
|
2 |
|
3 |
m1d_param_straight Type:func
|
4 |
|
5 |
Parametrage d'une droite
|
6 |
|
7 |
Date de creation : Thu Nov 28 10:27:03 1996
|
8 |
|
9 |
Derniere version : Tue Jun 3 11:55:51 1997
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
Vincent FRANCOIS
|
20 |
|
21 |
*****************************************************************/
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
/**************************/
|
28 |
/* include */
|
29 |
#include <stdio.h>
|
30 |
#include <string.h>
|
31 |
#include <math.h>
|
32 |
#include <stdlib.h>
|
33 |
#include "const.h"
|
34 |
#include "struct.h"
|
35 |
#include "memoire.h"
|
36 |
#include "prototype.h"
|
37 |
|
38 |
|
39 |
|
40 |
/**************************/
|
41 |
/* variables globales */
|
42 |
extern struct s_acis *acis;
|
43 |
extern struct s_param *para;
|
44 |
|
45 |
|
46 |
/**************************/
|
47 |
/* programme principal */
|
48 |
|
49 |
void m1d_param_straight(struct s_edge *edge,struct s_straight *straight)
|
50 |
{
|
51 |
struct s_point *p1,*p2;
|
52 |
|
53 |
|
54 |
NEW_ENTITE(straight->param,par_straight,para->);
|
55 |
memcpy(straight->param->root,straight->root,3*sizeof(float));
|
56 |
memcpy(straight->param->dir,straight->dir,3*sizeof(float));
|
57 |
if (edge->sense==0)
|
58 |
{
|
59 |
p1=edge->start_vertex->point;
|
60 |
p2=edge->end_vertex->point;
|
61 |
}
|
62 |
else
|
63 |
{
|
64 |
p2=edge->start_vertex->point;
|
65 |
p1=edge->end_vertex->point;
|
66 |
}
|
67 |
if (!(EGAL(straight->param->dir[0],0.,0.0001)))
|
68 |
{
|
69 |
edge->t1=(p1->coord[0]-straight->param->root[0])/straight->param->dir[0];
|
70 |
edge->t2=(p2->coord[0]-straight->param->root[0])/straight->param->dir[0];
|
71 |
}
|
72 |
else
|
73 |
if (!(EGAL(straight->param->dir[1],0.,0.0001)))
|
74 |
{
|
75 |
edge->t1=(p1->coord[1]-straight->param->root[1])/straight->param->dir[1];
|
76 |
edge->t2=(p2->coord[1]-straight->param->root[1])/straight->param->dir[1];
|
77 |
}
|
78 |
else
|
79 |
{
|
80 |
edge->t1=(p1->coord[2]-straight->param->root[2])/straight->param->dir[2];
|
81 |
edge->t2=(p2->coord[2]-straight->param->root[2])/straight->param->dir[2];
|
82 |
}
|
83 |
edge->t2=edge->t2-edge->t1;
|
84 |
}
|