commit du soir, espoir

This commit is contained in:
tTh 2023-04-15 00:56:48 +02:00
parent 300bcfa7a0
commit 02bbdc7249
4 changed files with 84 additions and 4 deletions

View File

@ -3,10 +3,18 @@ BBFUNCS = ../libbubulles.a
OPT = -Wall -Wextra -g -DDEBUG_LEVEL=0 -DMUST_ABORT=0
# ---------
read_obj: read_obj.c Makefile importobj.o rdwredges.o \
$(BBFUNCS)
gcc $(OPT) $< importobj.o rdwredges.o $(BBFUNCS) -o $@
export_evblob: export_evblob.c Makefile importobj.o rdwredges.o \
$(BBFUNCS)
gcc $(OPT) $< importobj.o rdwredges.o $(BBFUNCS) -o $@
# ---------
importobj.o: importobj.c ../bubulles.h ../edges.h Makefile
$(CC) $(OPT) -c $<

70
tools/export_evblob.c Normal file
View File

@ -0,0 +1,70 @@
/*
* 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;
}
/* --------------------------------------------------------------------- */

View File

@ -158,7 +158,7 @@ for (ix=0; ix<3; ix++) {
if (dropped) {
fprintf(stderr, "%s: %d dropped...\n", __func__, dropped);
exit(1);
// exit(1);
}
#if DEBUG_LEVEL
@ -309,7 +309,7 @@ bubulles_to_data(file_vert, NULL, bublist, 0);
edges_to_data(file_edges, edges, 0);
foo = x_write_vertedges("foo.blob", bublist, edges);
foo = x_write_vertedges("foo.evblob", bublist, edges);
// Cleanup
free_bubulles(bublist, 0);

View File

@ -39,8 +39,10 @@ int idx, edg[2];
double coo[3];
int nbre;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %p %p )\n", __func__, filename,
bblist, edges);
#endif
if (NULL==(fp=fopen(filename, "w"))) {
perror(filename);
@ -52,7 +54,7 @@ fwrite("VERTICES", 8, 1, fp);
nbre = bblist->fidx;
fwrite(&nbre, sizeof(int), 1, fp);
for (idx=0; idx<bblist->fidx; idx++) {
fprintf(stderr, "vertice %d\n", idx);
// fprintf(stderr, "vertice %d\n", idx);
coo[0] = bblist->bbs[idx].p.x;
coo[1] = bblist->bbs[idx].p.y;
coo[2] = bblist->bbs[idx].p.z;