~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/file/geom/geom2_wrt.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2   */
  3 #include <stdio.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 #include <tina/vision.h>
  9 #include <tina/visionfuncs.h>
 10 
 11 void    line2_fprint(FILE * fp, Line2 * line)
 12 {
 13     (void) fprintf(fp, "S %d 1 %f ", line->label, line->length);
 14     vec3_print(fp, vec3_of_vec2(line->p1));
 15     vec3_print(fp, vec3_of_vec2(line->p2));
 16     vec3_print(fp, vec3_of_vec2(line->v));
 17     (void) fprintf(fp, "\n");
 18 }
 19 
 20 void    conic2_fprint(FILE * fp, Conic * conic)
 21 {
 22     if (conic->type != ELLIPSE)
 23         return;
 24 
 25     (void) fprintf(fp, "E %d ", conic->label);
 26     vec3_print(fp, vec3_of_vec2(conic->center));
 27     vec3_print(fp, vec3(1.0, 0.0, 0.0));
 28     vec3_print(fp, vec3(0.0, 1.0, 0.0));
 29     (void) fprintf(fp, "%f %f %f ", conic->theta, conic->alpha, conic->beta);
 30     (void) fprintf(fp, "%f %f\n", conic->t1, conic->t2);
 31 }
 32 
 33 static void geom_fprintf(void *geom, int type, FILE * fp)
 34 {
 35     switch (type)
 36     {
 37         case LINE2:
 38         line2_fprint(fp, (Line2 *) geom);
 39         break;
 40     case CONIC2:
 41         conic2_fprint(fp, (Conic *) geom);
 42         break;
 43     default:
 44         break;
 45     }
 46 }
 47 
 48 /* BUGFIX: Julian Briggs 1/11/93. Was:List   *geom2_write_fp(FILE * fp,
 49  * List * geom) */
 50 void    geom2_write_fp(FILE * fp, List * geom)
 51 {
 52     reclist_list_apply(geom, geom_fprintf, (int) NULL, fp);
 53 }
 54 
 55 void    geom2_write(char *pathname, List * geom)
 56 {
 57     char    temps[256];
 58     FILE   *fp;
 59 
 60     if ((fp = fopen(pathname, "w")) == NULL)
 61     {
 62         (void) string_append(temps, "can not open file ", pathname, 0);
 63         error(temps, non_fatal);
 64         return;
 65     }
 66     geom2_write_fp(fp, geom);
 67     (void) fclose(fp);
 68 }
 69 
 70 void    line2_write_geom(char *pathname, List * geom)   /* historical */
 71 
 72 
 73 {
 74     geom2_write(pathname, geom);
 75 }
 76 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.