ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/acismesh/m1d_geo.cpp
Revision: 1
Committed: Mon Jun 11 22:53:07 2007 UTC (17 years, 11 months ago)
File size: 3097 byte(s)
Log Message:

File Contents

# User Rev Content
1 1 /*****************************************************************
2    
3     m1d_geo.c Type:Func
4    
5     Discretisation pour visualisation de la geometrie
6    
7     Date de creation : Thu Nov 28 11:24:25 1996
8    
9     Derniere version : Tue Apr 22 11:54:21 1997
10    
11    
12    
13    
14     Vincent FRANCOIS
15    
16     *****************************************************************/
17    
18    
19    
20    
21    
22     /**************************/
23     /* include */
24     #include <stdio.h>
25     #include <string.h>
26     #include "const.h"
27     #include "memoire.h"
28     #include "struct.h"
29     #include "prototype.h"
30    
31    
32     /**************************/
33     /* variables globales */
34     extern struct s_acis *acis;
35     extern struct s_param *para;
36     extern struct environnement env;
37    
38    
39     /**************************/
40     /* programme principal */
41    
42     void m1d_geo(void)
43     {
44     FILE *out;
45     char string[255];
46     int i,num,j;
47     struct s_edge *edge;
48     struct s_ellipse *ellipse;
49     float coord[3],t1,t2,t;
50    
51     strcpy(string,env.fich);
52     string[strlen(string)-4]=0;
53     strcat(string,".geo");
54     out=fopen(string,"wt");
55    
56     fprintf(out,"%d\n",acis->nb_edge);
57     for (i=0;i<acis->nb_edge;i++)
58     {
59     edge=ADRESSE(i,edge,acis->);
60     if (strcmp(acis->type_entite[edge->curve],"straight-curve")==0)
61     {
62     fprintf(out,"2\n");
63     fprintf(out,"%f %f %f\n",edge->start_vertex->point->coord[0],edge->start_vertex->point->coord[1],edge->start_vertex->point->coord[2]);
64     fprintf(out,"%f %f %f\n",edge->end_vertex->point->coord[0],edge->end_vertex->point->coord[1],edge->end_vertex->point->coord[2]);
65     }
66     if (strcmp(acis->type_entite[edge->curve],"ellipse-curve")==0)
67     {
68     ellipse=(struct s_ellipse *)acis->entity[edge->curve];
69     t1=edge->t1;
70     t2=t1+edge->t2;
71     t=(t2-t1)/0.1;
72     num=(int)(t);
73     fprintf(out,"%d\n",num+1);
74     if (edge->sense==0) fprintf(out,"%f %f %f\n",edge->start_vertex->point->coord[0],edge->start_vertex->point->coord[1],edge->start_vertex->point->coord[2]);
75     else fprintf(out,"%f %f %f\n",edge->end_vertex->point->coord[0],edge->end_vertex->point->coord[1],edge->end_vertex->point->coord[2]);
76     for (j=1;j<num;j++)
77     {
78     t=t1+j*0.1;
79     eval_ellipse(ellipse->param,t,FONCTION,coord);
80     fprintf(out,"%f %f %f\n",coord[0],coord[1],coord[2]);
81     }
82     if (edge->sense==0) fprintf(out,"%f %f %f\n",edge->end_vertex->point->coord[0],edge->end_vertex->point->coord[1],edge->end_vertex->point->coord[2]);
83     else fprintf(out,"%f %f %f\n",edge->start_vertex->point->coord[0],edge->start_vertex->point->coord[1],edge->start_vertex->point->coord[2]);
84    
85     }
86     }
87     fclose(out);
88    
89    
90     }