libbubulle/tools/export_evblob.c

71 lines
1.5 KiB
C
Raw Normal View History

2023-04-15 09:56:48 +11:00
/*
* EdgesAndVertices
https://git.tetalab.org/tTh/libbubulle/src/branch/master/tools/
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../bubulles.h"
#include "../edges.h"
#include "objtrucs.h"
int verbosity;
/* --------------------------------------------------------------------- */
/* EXPERIMENTAL GRUIK-CODE !!! */
int main(int argc, char *argv[])
{
EdgesAndVertices eav;
int foo, idx, a, b;
fprintf(stderr, "### EdgesAndVertices - %s %s\n", __DATE__, __TIME__);
verbosity = 0;
memset(&eav, 0, sizeof(EdgesAndVertices));
foo = x_load_vertedges("foo.evblob", &eav);
fprintf(stderr, " load vertice & edges blob -> %d\n", foo);
if (verbosity) {
fprintf(stderr, "vertices at %p\n", eav.Blist);
fprintf(stderr, "edges at %p\n", eav.Elist);
fprintf(stderr, "status is %d\n", eav.status);
}
/*
* OK we have (maybe) all the data in da place
* and we can spit all the edges to stdout
*/
fprintf(stderr, "got %d vertices and %d edges\n",
eav.Blist->fidx,
eav.Elist->fidx);
for (idx=0; idx<eav.Elist->fidx; idx++) {
a = eav.Elist->edges[idx].A;
b = eav.Elist->edges[idx].B;
// fprintf(stderr, "%7d %7d\n", a, b);
printf("%.9f %f %f %f %f %f\n",
eav.Blist->bbs[a].p.x,
eav.Blist->bbs[a].p.y,
eav.Blist->bbs[a].p.z,
eav.Blist->bbs[b].p.x,
eav.Blist->bbs[b].p.y,
eav.Blist->bbs[b].p.z );
}
return 0;
}
/* --------------------------------------------------------------------- */