1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
r3d_ins_segment.cpp Type:Func
|
4 |
|
|
|
5 |
|
|
Insertion d un segment dans le remaillage
|
6 |
|
|
|
7 |
|
|
Date de creation : 18-8-1997 10 :29 :37
|
8 |
|
|
Derniere version : 18-8-1997 10 :29 :37
|
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 <stdlib.h>
|
24 |
|
|
#include "const.h"
|
25 |
|
|
#include "memoire.h"
|
26 |
|
|
#include "struct.h"
|
27 |
|
|
#include "prototype.h"
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
/**************************/
|
31 |
|
|
/* variables globales */
|
32 |
|
|
extern struct s_acis *acis;
|
33 |
|
|
extern struct environnement env;
|
34 |
|
|
extern struct s_mesh *mesh;
|
35 |
|
|
extern struct s_param *para;
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
/**************************/
|
40 |
|
|
/* programme principal */
|
41 |
|
|
|
42 |
|
|
void r3d_ins_segment(struct s_face *face,int n1,int n2,struct s_segment **triseg)
|
43 |
|
|
{
|
44 |
|
|
struct s_noeud *no1,*no2;
|
45 |
|
|
struct s_segment *seg,*segref;
|
46 |
|
|
int ok,i,num;
|
47 |
|
|
float vec[4];
|
48 |
|
|
|
49 |
|
|
no1=ADRESSE(n1,noeud,mesh->);
|
50 |
|
|
no2=ADRESSE(n2,noeud,mesh->);
|
51 |
|
|
ok=0;
|
52 |
|
|
for (i=0;i<no1->nb_segment;i++)
|
53 |
|
|
{
|
54 |
|
|
seg=no1->segment[i];
|
55 |
|
|
if ((seg->n1==n2)||(seg->n2==n2))
|
56 |
|
|
{
|
57 |
|
|
ok=1;
|
58 |
|
|
segref=seg;
|
59 |
|
|
}
|
60 |
|
|
}
|
61 |
|
|
if (ok==1) segref->front++;
|
62 |
|
|
else
|
63 |
|
|
{
|
64 |
|
|
NEW_ENTITE(seg,segment,mesh->);
|
65 |
|
|
seg->n1=n1;
|
66 |
|
|
seg->n2=n2;
|
67 |
|
|
seg->num=mesh->nb_segment-1;
|
68 |
|
|
seg->front=1;
|
69 |
|
|
VEC(vec,no1,no2);
|
70 |
|
|
seg->longueur=(float)sqrt((double)PSCA(vec,vec));
|
71 |
|
|
NEW_POINTEUR(num,segment,no1->);
|
72 |
|
|
no1->segment[num]=seg;
|
73 |
|
|
NEW_POINTEUR(num,segment,no2->);
|
74 |
|
|
no2->segment[num]=seg;
|
75 |
|
|
qu_ins_obj(SEGMENT,seg->num,mesh->root);
|
76 |
|
|
}
|
77 |
|
|
if (no1->type==0)
|
78 |
|
|
{
|
79 |
|
|
no1->type=FACE;
|
80 |
|
|
no1->num_ent=face->num;
|
81 |
|
|
}
|
82 |
|
|
if (no2->type==0)
|
83 |
|
|
{
|
84 |
|
|
no2->type=FACE;
|
85 |
|
|
no2->num_ent=face->num;
|
86 |
|
|
}
|
87 |
|
|
(*triseg)=seg;
|
88 |
|
|
}
|