1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
m2d_ini_front.c Type:Func
|
4 |
|
|
|
5 |
|
|
Initialisation du front
|
6 |
|
|
|
7 |
|
|
Date de creation : Wed Feb 5 17:23:50 1997
|
8 |
|
|
|
9 |
|
|
Derniere version : Fri May 9 11:46:46 1997
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
Vincent FRANCOIS
|
23 |
|
|
|
24 |
|
|
*****************************************************************/
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
/**************************/
|
31 |
|
|
/* include */
|
32 |
|
|
#include <stdio.h>
|
33 |
|
|
#include <string.h>
|
34 |
|
|
#include "const.h"
|
35 |
|
|
#include "memoire.h"
|
36 |
|
|
#include "struct.h"
|
37 |
|
|
#include "prototype.h"
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
/**************************/
|
41 |
|
|
/* variables globales */
|
42 |
|
|
extern struct environnment env;
|
43 |
|
|
extern struct s_mesh *mesh;
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/**************************/
|
48 |
|
|
/* programme principal */
|
49 |
|
|
|
50 |
|
|
void m2d_ini_front(struct s_face *face)
|
51 |
|
|
{
|
52 |
|
|
struct s_segment *seg,*ac_seg,*segref;
|
53 |
|
|
struct s_noeud *no1,*no2,*no_dep,*no,*no_fin;
|
54 |
|
|
struct s_front *ft,*ftp,*ft_premier;
|
55 |
|
|
struct s_frontiere *fr;
|
56 |
|
|
struct s_loop *loop;
|
57 |
|
|
struct s_coedge *coedge;
|
58 |
|
|
int i,premier;
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
for (i=0;i<mesh->nb_segment;i++)
|
62 |
|
|
{
|
63 |
|
|
seg=ADRESSE(i,segment,mesh->);
|
64 |
|
|
no1=ADRESSE(seg->n1,noeud,mesh->);
|
65 |
|
|
no2=ADRESSE(seg->n2,noeud,mesh->);
|
66 |
|
|
if ((no1->indice==face->num)&&(no2->indice==face->num)) qu_ins_obj(SEGMENT,seg->num,mesh->root);
|
67 |
|
|
}
|
68 |
|
|
for (i=0;i<mesh->nb_frontiere;i++)
|
69 |
|
|
{
|
70 |
|
|
fr=ADRESSE(i,frontiere,mesh->);
|
71 |
|
|
qu_ins_obj(FRONTIERE,fr->num,mesh->root);
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
/* constitution du front */
|
77 |
|
|
for (loop=face->first_loop;loop!=NULL;loop=loop->next_loop)
|
78 |
|
|
{
|
79 |
|
|
coedge=loop->first_coedge;
|
80 |
|
|
if (coedge->sense==FORWARD) no_dep=coedge->edge->start_vertex->noeud;
|
81 |
|
|
else no_dep=coedge->edge->end_vertex->noeud;
|
82 |
|
|
no=no_dep;
|
83 |
|
|
ftp=NULL;
|
84 |
|
|
premier=0;
|
85 |
|
|
do
|
86 |
|
|
{
|
87 |
|
|
if (no==coedge->edge->start_vertex->noeud) no_fin=coedge->edge->end_vertex->noeud;
|
88 |
|
|
else no_fin=coedge->edge->start_vertex->noeud;
|
89 |
|
|
ac_seg=NULL;
|
90 |
|
|
do
|
91 |
|
|
{
|
92 |
|
|
if (((coedge->sense==REVERSED)^((no_dep->num==no_fin->num) && (coedge->edge->sense==REVERSED)))==1)
|
93 |
|
|
for (i=0;i<no->nb_segment;i++)
|
94 |
|
|
{
|
95 |
|
|
seg=no->segment[i];
|
96 |
|
|
if (((seg->n1==no->num)||(seg->n2==no->num))&&(seg!=ac_seg)&&(seg->num_ent==coedge->edge->num)) segref=seg;
|
97 |
|
|
}
|
98 |
|
|
else
|
99 |
|
|
for (i=no->nb_segment-1;i>(-1);i--)
|
100 |
|
|
{
|
101 |
|
|
seg=no->segment[i];
|
102 |
|
|
if (((seg->n1==no->num)||(seg->n2==no->num))&&(seg!=ac_seg)&&(seg->num_ent==coedge->edge->num)) segref=seg;
|
103 |
|
|
}
|
104 |
|
|
ac_seg=segref;
|
105 |
|
|
m2d_ac_front(&ft,2);
|
106 |
|
|
if (premier==0)
|
107 |
|
|
{
|
108 |
|
|
ft_premier=ft;
|
109 |
|
|
premier=1;
|
110 |
|
|
}
|
111 |
|
|
ft->n1=no->num;
|
112 |
|
|
if (ac_seg->n1==no->num) ft->n2=ac_seg->n2; else ft->n2=ac_seg->n1;
|
113 |
|
|
ft->seg=ac_seg;
|
114 |
|
|
ft->seg->front=1;
|
115 |
|
|
ft->prec=ftp;
|
116 |
|
|
if (ftp!=NULL) ftp->suiv=ft;
|
117 |
|
|
m2d_ord_front(ft);
|
118 |
|
|
ftp=ft;
|
119 |
|
|
no=ADRESSE(ft->n2,noeud,mesh->);
|
120 |
|
|
}
|
121 |
|
|
while (no!=no_fin);
|
122 |
|
|
coedge=coedge->next_coedge;
|
123 |
|
|
}
|
124 |
|
|
while (coedge!=loop->first_coedge);
|
125 |
|
|
ft_premier->prec=ft;
|
126 |
|
|
ft->suiv=ft_premier;
|
127 |
|
|
}
|
128 |
|
|
}
|