| 1 |
|
1 |
/*****************************************************************
|
| 2 |
|
|
|
| 3 |
|
|
r3d_m1d.cpp Type:Func
|
| 4 |
|
|
|
| 5 |
|
|
Remmaillage des edge
|
| 6 |
|
|
|
| 7 |
|
|
Date de creation : 12-8-1997 14 :36 :35
|
| 8 |
|
|
Derniere version : 12-8-1997 14 :36 :35
|
| 9 |
|
|
|
| 10 |
|
|
Vincent FRANCOIS
|
| 11 |
|
|
|
| 12 |
|
|
*****************************************************************/
|
| 13 |
|
|
|
| 14 |
|
|
|
| 15 |
|
|
|
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
|
|
/**************************/
|
| 19 |
|
|
/* include */
|
| 20 |
|
|
|
| 21 |
|
|
|
| 22 |
|
|
|
| 23 |
|
|
/**************************/
|
| 24 |
|
|
/* variables globales */
|
| 25 |
|
|
#include <stdio.h>
|
| 26 |
|
|
#include <string.h>
|
| 27 |
|
|
#include <stdlib.h>
|
| 28 |
|
|
#include "const.h"
|
| 29 |
|
|
#include "memoire.h"
|
| 30 |
|
|
#include "struct.h"
|
| 31 |
|
|
#include "prototype.h"
|
| 32 |
|
|
|
| 33 |
|
|
/**************************/
|
| 34 |
|
|
/* variables globales */
|
| 35 |
|
|
extern struct environnement env;
|
| 36 |
|
|
extern struct s_mesh *mesh;
|
| 37 |
|
|
extern struct s_maillage *maillage;
|
| 38 |
|
|
extern struct s_acis *acis;
|
| 39 |
|
|
|
| 40 |
|
|
void r3d_m1d(void)
|
| 41 |
|
|
{
|
| 42 |
|
|
int i,j,k;
|
| 43 |
|
|
struct s_edge *edge;
|
| 44 |
|
|
struct s_noeud *no1,*no2,*no,*noo,*no1a,*no1b;
|
| 45 |
|
|
struct s_segment *seg,*segref,*segrech;
|
| 46 |
|
|
float indice,indic1,indic2;
|
| 47 |
|
|
|
| 48 |
|
|
for (i=0;i<acis->nb_edge;i++)
|
| 49 |
|
|
{
|
| 50 |
|
|
edge=ADRESSE(i,edge,acis->);
|
| 51 |
|
|
if (edge->sense==0)
|
| 52 |
|
|
{
|
| 53 |
|
|
no1=edge->start_vertex->noeud;
|
| 54 |
|
|
no2=edge->end_vertex->noeud;
|
| 55 |
|
|
}
|
| 56 |
|
|
else
|
| 57 |
|
|
{
|
| 58 |
|
|
no2=edge->start_vertex->noeud;
|
| 59 |
|
|
no1=edge->end_vertex->noeud;
|
| 60 |
|
|
}
|
| 61 |
|
|
no1->pos=edge->t1;
|
| 62 |
|
|
no2->pos=edge->t1+edge->t2;
|
| 63 |
|
|
no=no1;
|
| 64 |
|
|
segref=NULL;
|
| 65 |
|
|
k=(-1);
|
| 66 |
|
|
if ((edge->nb_segment==0)&& (no1==no2)) r3d_dis(edge,no1,no2);
|
| 67 |
|
|
else do
|
| 68 |
|
|
{
|
| 69 |
|
|
k++;
|
| 70 |
|
|
segrech=NULL;
|
| 71 |
|
|
for (j=0;j<edge->nb_segment;j++)
|
| 72 |
|
|
{
|
| 73 |
|
|
seg=edge->segment[j];
|
| 74 |
|
|
if ((seg!=segref)&&((seg->n1==no->num)||(seg->n2==no->num)))
|
| 75 |
|
|
if (segrech!=NULL)
|
| 76 |
|
|
{
|
| 77 |
|
|
no1a=ADRESSE(seg->n1,noeud,mesh->);
|
| 78 |
|
|
no1b=ADRESSE(seg->n2,noeud,mesh->);
|
| 79 |
|
|
if (no1a->num==no->num) indic1=no1b->pos; else indic1=no1a->pos;
|
| 80 |
|
|
no1a=ADRESSE(segrech->n1,noeud,mesh->);
|
| 81 |
|
|
no1b=ADRESSE(segrech->n2,noeud,mesh->);
|
| 82 |
|
|
if (no1a->num==no->num) indic2=no1b->pos; else indic2=no1a->pos;
|
| 83 |
|
|
if (indic1<indic2) segrech=seg;
|
| 84 |
|
|
}
|
| 85 |
|
|
else segrech=seg;
|
| 86 |
|
|
}
|
| 87 |
|
|
if ((segrech!=NULL) && (k==0) && (no1==no2))
|
| 88 |
|
|
{
|
| 89 |
|
|
if (segrech->n1==no->num) noo=ADRESSE(segrech->n2,noeud,mesh->);
|
| 90 |
|
|
else noo=ADRESSE(segrech->n1,noeud,mesh->);
|
| 91 |
|
|
for (j=0;j<edge->nb_segment;j++)
|
| 92 |
|
|
{
|
| 93 |
|
|
seg=edge->segment[j];
|
| 94 |
|
|
no1a=ADRESSE(seg->n1,noeud,mesh->);
|
| 95 |
|
|
no1b=ADRESSE(seg->n2,noeud,mesh->);
|
| 96 |
|
|
if (no1a->pos<noo->pos) segrech=NULL;
|
| 97 |
|
|
if (no1b->pos<noo->pos) segrech=NULL;
|
| 98 |
|
|
}
|
| 99 |
|
|
}
|
| 100 |
|
|
if (segrech!=NULL)
|
| 101 |
|
|
{
|
| 102 |
|
|
if (segrech->n1==no->num) no=ADRESSE(segrech->n2,noeud,mesh->);
|
| 103 |
|
|
else no=ADRESSE(segrech->n1,noeud,mesh->);
|
| 104 |
|
|
segref=segrech;
|
| 105 |
|
|
}
|
| 106 |
|
|
else
|
| 107 |
|
|
{
|
| 108 |
|
|
indice=no2->pos;
|
| 109 |
|
|
noo=NULL;
|
| 110 |
|
|
for (j=0;j<edge->nb_segment;j++)
|
| 111 |
|
|
{
|
| 112 |
|
|
seg=edge->segment[j];
|
| 113 |
|
|
no1a=ADRESSE(seg->n1,noeud,mesh->);
|
| 114 |
|
|
no1b=ADRESSE(seg->n2,noeud,mesh->);
|
| 115 |
|
|
if ((no1a->pos>no->pos) && (no1a->pos<indice))
|
| 116 |
|
|
{
|
| 117 |
|
|
indice=no1a->pos;
|
| 118 |
|
|
noo=no1a;
|
| 119 |
|
|
}
|
| 120 |
|
|
if ((no1b->pos>no->pos) && (no1b->pos<indice))
|
| 121 |
|
|
{
|
| 122 |
|
|
indice=no1b->pos;
|
| 123 |
|
|
noo=no1b;
|
| 124 |
|
|
}
|
| 125 |
|
|
}
|
| 126 |
|
|
if (noo==NULL) noo=no2;
|
| 127 |
|
|
segref=r3d_dis(edge,no,noo);
|
| 128 |
|
|
no=noo;
|
| 129 |
|
|
}
|
| 130 |
|
|
}
|
| 131 |
|
|
while (no!=no2);
|
| 132 |
|
|
}
|
| 133 |
|
|
|
| 134 |
|
|
|
| 135 |
|
|
|
| 136 |
|
|
}
|