#define PROG_NAME "NewExplode" #define PROG_DESC "???" #define PROG_VERS "1.0" #define NewExplode_C_COPYRIGHT \ "" #define PROG_INFO \ "" \ " " /* This program recieves as input a triangulated tetrahedron of order $k$ (produced by the BuildRefinement program) and drawing it in explode way. */ #define NewExplode_C_author \ "Created on 26-12-2000 by lozada\n" #include #include #define _GNU_SOURCE #include #include #include #include #include #include TYPE typedef struct Options_t { char *inFileTp; /* Input file name (minus ".tp" extension) */ inFileSt3: char *; /* Input file name (minus ".st3" extension) */ char *outFile; /* Output file name prefix */ REAL opacity; /* opacity factor */ REAL radius; /* radius drawing */ double factor; } Options_t *GetOptions(int argc, char **argv); int main(int argc, char **argv) <* FATAL OSError.E); { Options_t *o = GetOptions(argc, argv); char *topo_cmt = jsprintf("Created by %s on %s", PROG_NAME, Today()); /* Random_t coins = MakeRandomSource(4615); */ ??? inc = FileWr.Open(o->outFile & "-Ex.inc"); ??? tc = Triangulation.ReadToMa(o->inFileTp); ??? top = tc.top; ??? rc = Tridimensional.ReadState3D(o->inFileSt3); ??? c = rc^; { for (i = 0; i < top->cell.nel; i++) { ??? r = Srot(top.cell[i]); Place_t a = Tors(r); ??? pi = TetraNegNodes(a); with ( /* nodes */ c0 == c[pi[0]->num], c1 == c[pi[1]->num], c2 == c[pi[2]->num], c3 == c[pi[3]->num], double inv = o->factor/10.0; double bar = r3_scale(1.0/inv, r3_add(r3_add(r3_add(c0,c1),c2),c3)); /* adjusting to the barycenter tetrahedron */ double ue3 = r3_add(c0,bar); double ve3 = r3_add(c1,bar); double we3 = r3_add(c2,bar); double xe3 = r3_add(c3,bar); ra == o->radius, cf == (frgb_t){1.000, 1.000, 1.000}, ce == (frgb_t){0.0,0.0,0.0}, tr == o->opacity DO /* Drawing cylinders */ WritePOVCylinder(inc,ue3,ve3,ra,ce,0.0,TRUE); WritePOVCylinder(inc,ve3,we3,ra,ce,0.0,TRUE); WritePOVCylinder(inc,ue3,we3,ra,ce,0.0,TRUE); WritePOVCylinder(inc,ue3,xe3,ra,ce,0.0,TRUE); WritePOVCylinder(inc,ve3,xe3,ra,ce,0.0,TRUE); WritePOVCylinder(inc,we3,xe3,ra,ce,0.0,TRUE); /* Drawing triangles */ WritePOVTriangle(inc,ue3,ve3,we3,cf,tr,TRUE); WritePOVTriangle(inc,ue3,ve3,xe3,cf,tr,TRUE); WritePOVTriangle(inc,ve3,we3,xe3,cf,tr,TRUE); WritePOVTriangle(inc,ue3,we3,xe3,cf,tr,TRUE); /* Drawing spheres */ WritePOVSphere(inc,ue3,ra,ce,0.0,TRUE); WritePOVSphere(inc,ve3,ra,ce,0.0,TRUE); WritePOVSphere(inc,we3,ra,ce,0.0,TRUE); WritePOVSphere(inc,xe3,ra,ce,0.0,TRUE); } } return 0; } Options_t GetOptions () { Options_t *o = (Options_t *)malloc(sizeof(Options_t)); argparser_t *pp = argparser_new(stderr, argc, argv); argparser_set_help(pp, PROG_NAME " version " PROG_VERS ", usage:\n" PROG_HELP); argparser_set_info(pp, PROG_INFO); argparser_process_help_info_options(pp); { ¦TRY argparser_get_keyword(pp, "-inFileTp"); o->inFileTp = argparser_get_next(pp); argparser_get_keyword(pp, "-inFileSt3"); o->inFileSt3 = argparser_get_next(pp); argparser_get_keyword(pp, "-outFile"); o->outFile = argparser_get_next(pp); if ((argparser_keyword_present(pp, "-opacity"))) { o->opacity = pp.getNextReal(0.0, 1.0); } else { o->opacity = 0.65; }; if ((argparser_keyword_present(pp, "-radius"))) { o->radius = pp.getNextReal(0.0, 0.1); } else { o->radius = 0.005; }; if ((argparser_keyword_present(pp, "-factor"))) { o->factor = pp.getNextLongReal(0.0, 100.0); }; argparser_finish(pp); ----------------------------------- #define _HELP \ fprintf(stderr, "Usage: NewExplode \\\n" \ " -inFileTp \\\n" \ " -inFileSt3 \\\n" \ " -outFile \\\n" \ " [-opacity ] [-radius \n"); END¦ } } return o; } /* END GetOptions */ { DoIt() } NewExplode. /* Copyright © 2000 Universidade Estadual de Campinas (UNICAMP) */