1 |
/*****************************************************************
|
2 |
|
3 |
r3d_m2d.cpp Type:Func
|
4 |
|
5 |
Remaillage des faces
|
6 |
|
7 |
Date de creation : 13-8-1997 17 :9 :9
|
8 |
Derniere version : 13-8-1997 17 :9 :9
|
9 |
|
10 |
Vincent FRANCOIS
|
11 |
|
12 |
*****************************************************************/
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
/**************************/
|
19 |
/* include */
|
20 |
#include <stdio.h>
|
21 |
#include <string.h>
|
22 |
#include <stdlib.h>
|
23 |
#include "const.h"
|
24 |
#include "memoire.h"
|
25 |
#include "struct.h"
|
26 |
#include "prototype.h"
|
27 |
|
28 |
|
29 |
/**************************/
|
30 |
/* variables globales */
|
31 |
extern struct s_acis *acis;
|
32 |
extern struct environnement env;
|
33 |
extern struct s_mesh *mesh;
|
34 |
extern struct s_maillage *maillage;
|
35 |
extern struct s_param *para;
|
36 |
|
37 |
|
38 |
|
39 |
/**************************/
|
40 |
/* programme principal */
|
41 |
|
42 |
void r3d_m2d(struct s_octree **liste)
|
43 |
{
|
44 |
struct s_face *face;
|
45 |
struct s_cone *cone;
|
46 |
struct s_plane *plane;
|
47 |
struct s_quadtree *quadtree;
|
48 |
int j,nb_tri;
|
49 |
char message[255];
|
50 |
int i,nb_facette,*tab_facette;
|
51 |
|
52 |
|
53 |
for (j=0;j<acis->nb_face;j++)
|
54 |
{
|
55 |
voir();
|
56 |
face=ADRESSE(j,face,acis->);
|
57 |
/* phase 1 parametrisation des surface */
|
58 |
if (strcmp(acis->type_entite[face->surface],"cone-surface")==0)
|
59 |
{
|
60 |
cone=(struct s_cone *)acis->entity[face->surface];
|
61 |
m2d_param_cone(face,cone);
|
62 |
}
|
63 |
if (strcmp(acis->type_entite[face->surface],"plane-surface")==0)
|
64 |
{
|
65 |
plane=(struct s_plane *)acis->entity[face->surface];
|
66 |
m2d_param_plane(face,plane);
|
67 |
}
|
68 |
}
|
69 |
|
70 |
|
71 |
|
72 |
for (j=0;j<acis->nb_face;j++)
|
73 |
{
|
74 |
voir();
|
75 |
face=ADRESSE(j,face,acis->);
|
76 |
sprintf(message,R3D_M2D_FACE,j,face->num);
|
77 |
aff_text(message);
|
78 |
nb_tri=mesh->nb_triangle;
|
79 |
cone=NULL;
|
80 |
plane=NULL;
|
81 |
/* phase 1 determination de la surface */
|
82 |
if (strcmp(acis->type_entite[face->surface],"cone-surface")==0)
|
83 |
cone=(struct s_cone *)acis->entity[face->surface];
|
84 |
if (strcmp(acis->type_entite[face->surface],"plane-surface")==0)
|
85 |
plane=(struct s_plane *)acis->entity[face->surface];
|
86 |
/* phase 2 constitution des frontieres */
|
87 |
NEW_ALLOC(frontiere,mesh->);
|
88 |
NEW_ALLOC(quadtree,mesh->);
|
89 |
NEW_ALLOC(front,mesh->);
|
90 |
m2d_frontiere(face);
|
91 |
/* phase 3 creation de la grille */
|
92 |
if (cone!=NULL) m2d_c_quad(face,2*PI,0.);
|
93 |
if (plane!=NULL) m2d_c_quad(face,0.,0.);
|
94 |
/* phase 4 initialisation du front */
|
95 |
m2d_ini_front(face);
|
96 |
mesh->tete_triangle=NULL;
|
97 |
/* phase 5 insertion des triangles recuperer */
|
98 |
nb_facette=0;
|
99 |
tab_facette=(int *)calloc(maillage->nb_mfacette,sizeof(int));
|
100 |
ERREUR_ALLOC(tab_facette);
|
101 |
r3d_rech_facette(face,&nb_facette,tab_facette);
|
102 |
r3d_ins_triangle(face,nb_facette,tab_facette,liste);
|
103 |
free(tab_facette);
|
104 |
/* phase 6 maillage */
|
105 |
m2d_gest_front(face);
|
106 |
/* phase 7 optimisation de maillage */
|
107 |
o2d(face);
|
108 |
/* analyse de densite */
|
109 |
if (env.analyse==1)
|
110 |
m2d_ana_dens(face,nb_tri,mesh->nb_triangle);
|
111 |
/* fin */
|
112 |
mesh->nb_front=mesh->nb_front_tot;
|
113 |
LIBERE_LIEN(noeud,quadtree,mesh->);
|
114 |
LIBERE_LIEN(segment,quadtree,mesh->);
|
115 |
LIBERE_LIEN(triangle,quadtree,mesh->);
|
116 |
LIBERE_LIEN(frontiere,quadtree,mesh->);
|
117 |
LIBERE_LIEN(front,quadtree,mesh->);
|
118 |
LIBERE(quadtree,mesh->);
|
119 |
LIBERE(frontiere,mesh->);
|
120 |
LIBERE(front,mesh->);
|
121 |
mesh->tete_front=NULL;
|
122 |
mesh->vide_front=NULL;
|
123 |
m2d_enreg();
|
124 |
mesh->nb_front_tot=0;
|
125 |
}
|
126 |
sprintf(message,R3D_M2D_RES,maillage->nb_mfacette,mesh->nb_facette_attache);
|
127 |
aff_text(message);
|
128 |
m2d_fin();
|
129 |
m2d_resultat(2);
|
130 |
for (i=mesh->nb_noeud_traite;i<mesh->nb_noeud;i++)
|
131 |
oc_ins_obj(NOEUD,i,mesh->first);
|
132 |
mesh->nb_noeud_traite=mesh->nb_noeud;
|
133 |
}
|