Compare commits
	
		
			8 Commits
		
	
	
		
			6f254b6ff4
			...
			b861e8c86b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | b861e8c86b | ||
|   | 9577f1da1f | ||
|   | 9e81fa8319 | ||
|   | a1e5058d97 | ||
|   | 3d93b66b00 | ||
|   | 26f6421653 | ||
|   | d1a5a5b5c9 | ||
|   | 329223d195 | 
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -5,9 +5,12 @@ libbubulles.a | ||||
| tbb | ||||
| gmon.out | ||||
| dummy-file | ||||
| toto | ||||
| 
 | ||||
| tools/*.obj | ||||
| ! tools/minimal.obj | ||||
| tools/read_obj | ||||
| tools/*.xyz | ||||
| tools/*.asc | ||||
| 
 | ||||
| tools/toto | ||||
| tools/core | ||||
|  | ||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @ -10,7 +10,7 @@ | ||||
| 
 | ||||
| CC = gcc | ||||
| 
 | ||||
| OPT = -Wall -g -pg -O3 -DDEBUG_LEVEL=0 -DMUST_ABORT=0 | ||||
| OPT = -Wall -g -pg  -DDEBUG_LEVEL=0 -DMUST_ABORT=0 | ||||
| 
 | ||||
| libbubulles.a:	bubulles.o edges.o | ||||
| 	ar r $@ $? | ||||
|  | ||||
							
								
								
									
										12
									
								
								bubulles.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								bubulles.c
									
									
									
									
									
								
							| @ -84,7 +84,7 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, bbl, k); | ||||
| 
 | ||||
| if (NULL == bbl->bbs) { | ||||
| 	fprintf(stderr, "%s : array ptr is null\n", __func__); | ||||
| #ifdef MUST_ABORT | ||||
| #if MUST_ABORT | ||||
| 	abort(); | ||||
| #endif | ||||
| 	return 1; | ||||
| @ -108,7 +108,7 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, where, idx); | ||||
| if ( (idx < 0) || (idx > where->fidx) ) { | ||||
| 	fprintf(stderr, "%s : idx %d out of range on %p\n", | ||||
| 				__func__, idx, where); | ||||
| #ifdef MUST_ABORT | ||||
| #if MUST_ABORT | ||||
| 	abort(); | ||||
| #endif | ||||
| 	return NULL; | ||||
| @ -186,7 +186,7 @@ int	peek_bubulle(BBList *from, Bubulle *to, int idx) | ||||
| 
 | ||||
| if (NULL==from) { | ||||
| 	fprintf(stderr, "in %s, *from is null\n", __func__); | ||||
| #ifdef MUST_ABORT | ||||
| #if MUST_ABORT | ||||
| 	abort(); | ||||
| #endif | ||||
| 	return -5; | ||||
| @ -216,7 +216,7 @@ Bubulle		*ar; | ||||
| 
 | ||||
| if (NULL == bbl) { | ||||
| 	fprintf(stderr, "in %s, *bbl is NULL\n", __func__); | ||||
| #ifdef MUST_ABORT | ||||
| #if MUST_ABORT | ||||
| 	abort(); | ||||
| #endif | ||||
| 	return -5; | ||||
| @ -261,7 +261,7 @@ int		idx; | ||||
| 
 | ||||
| if (NULL == what) { | ||||
| 	fprintf(stderr, "SHIT HAPPEN IN %s\n", __func__); | ||||
| #ifdef MUST_ABORT | ||||
| #if MUST_ABORT | ||||
| 	abort(); | ||||
| #endif | ||||
| 	return -5; | ||||
| @ -337,7 +337,7 @@ int print_bbox(BBox *bbox, int k) | ||||
| 
 | ||||
| if (NULL==bbox) { | ||||
| 	fprintf(stderr, "in %s, *bbox is NULL\n", __func__); | ||||
| #ifdef MUST_ABORT | ||||
| #if MUST_ABORT | ||||
| 	abort(); | ||||
| #endif | ||||
| 	return -5; | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
| 
 | ||||
| /* --------------------------------------------------------------------- */ | ||||
| 
 | ||||
| #define LIBBB_VERSION		61 | ||||
| #define LIBBB_VERSION		63 | ||||
| 
 | ||||
| #define SZ_BUBULLE_TEXT		81		/* arbitrary value */ | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										28
									
								
								edges.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								edges.c
									
									
									
									
									
								
							| @ -1,5 +1,6 @@ | ||||
| /*
 | ||||
|  *		edges.c | ||||
|  *	a part of libbubulle from tTh | ||||
|  */ | ||||
| 
 | ||||
| #include   <stdio.h> | ||||
| @ -15,7 +16,9 @@ EdgeList * alloc_edgelist(char *name, int sz, int flags) | ||||
| EdgeList	*elptr; | ||||
| AnEdge		*array; | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, ">>> %s ( '%s'  %d  0x%X )\n", __func__, name, sz, flags); | ||||
| #endif | ||||
| 
 | ||||
| if (NULL==(elptr = calloc(1, sizeof(EdgeList)))) { | ||||
| 	fprintf(stderr, "no mem available in %s\n", __func__); | ||||
| @ -44,8 +47,9 @@ return elptr; | ||||
| /* --------------------------------------------------------------------- */ | ||||
| int free_edgelist(EdgeList *list, int k) | ||||
| { | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, ">>> %s ( %p  0x%X )\n", __func__, list, k); | ||||
| #endif | ||||
| 
 | ||||
| if (k) { | ||||
| 	fprintf(stderr, "%s: k must be 0, was %d\n", __func__, k); | ||||
| @ -131,31 +135,39 @@ return 0;		/* NOT FOUND */ | ||||
| int  print_edgelist_desc(EdgeList *list, int k) | ||||
| { | ||||
| 
 | ||||
| fprintf(stderr, "--- edgelist '%s' at %p\n", list->name, list); | ||||
| fprintf(stderr, "------- edgelist '%s' at %p\n", list->name, list); | ||||
| 
 | ||||
| if (k) { | ||||
| 	fprintf(stderr, "%s: k must be 0, was %d\n", __func__, k); | ||||
| 	return k; | ||||
| 	} | ||||
| 
 | ||||
| fprintf(stderr, "    array @             %p\n",     list->edges); | ||||
| fprintf(stderr, "    size                %8d\n",    list->size); | ||||
| fprintf(stderr, "    next free           %8d\n",    list->fidx); | ||||
| // fprintf(stderr, "    magic             0x%08X\n",   list->magic);
 | ||||
| fprintf(stderr, "\tarray @             %p\n",       list->edges); | ||||
| fprintf(stderr, "\tsize                %8d\n",      list->size); | ||||
| fprintf(stderr, "\tnext free           %8d\n",      list->fidx); | ||||
| fprintf(stderr, "\tmagic              0x%08lX\n",   list->magic); | ||||
| 
 | ||||
| return 0; | ||||
| } | ||||
| /* --------------------------------------------------------------------- */ | ||||
| int  print_the_edges(EdgeList *list, int k) | ||||
| int  print_the_edges(FILE *fp, EdgeList *list, int k) | ||||
| { | ||||
| int		foo; | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, ">>> %s ( %p %d )\n", __func__, list, k); | ||||
| #endif | ||||
| 
 | ||||
| if (k) { | ||||
| 	fprintf(stderr, "In %s, k must be 0, was %d\n", __func__, k); | ||||
| 	return k; | ||||
| 	} | ||||
| 
 | ||||
| fprintf(stderr, "    list.fidx = %d\n", list->fidx); | ||||
| 
 | ||||
| for (foo=0; foo<list->fidx; foo++) { | ||||
| 	printf("%d\t\t%5d %5d\n", foo, list->edges[foo].A, list->edges[foo].B); | ||||
| 	fprintf(fp, "%6d\t\t%5d %5d\n", foo, | ||||
| 			list->edges[foo].A, list->edges[foo].B); | ||||
| 	} | ||||
| 
 | ||||
| return -1; | ||||
|  | ||||
							
								
								
									
										4
									
								
								edges.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								edges.h
									
									
									
									
									
								
							| @ -1,11 +1,13 @@ | ||||
| /*
 | ||||
|  *		edges.h | ||||
|  *	a part of libbubulle from tTh | ||||
|  */ | ||||
| 
 | ||||
| /* --------------------------------------------------------------------- */ | ||||
| 
 | ||||
| typedef struct { | ||||
| 	int		A, B; | ||||
| 	short		burz; | ||||
| 	} AnEdge; | ||||
| 
 | ||||
| typedef struct { | ||||
| @ -27,6 +29,6 @@ int push_a_missing_edge(EdgeList *list, int p0, int p1); | ||||
| int 		is_edge_in_list(EdgeList *list, int p0, int p1); | ||||
| 
 | ||||
| int  		print_edgelist_desc(EdgeList *list, int k); | ||||
| int  print_the_edges(EdgeList *list, int k); | ||||
| int  		print_the_edges(FILE *file, EdgeList *list, int k); | ||||
| 
 | ||||
| /* --------------------------------------------------------------------- */ | ||||
|  | ||||
							
								
								
									
										21
									
								
								tbb.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								tbb.c
									
									
									
									
									
								
							| @ -6,7 +6,7 @@ | ||||
| 
 | ||||
| #include  <stdio.h> | ||||
| #include  <stdlib.h> | ||||
| 
 | ||||
| #include  <unistd.h> | ||||
| #include  "bubulles.h" | ||||
| #include  "edges.h" | ||||
| 
 | ||||
| @ -27,19 +27,20 @@ print_edgelist_desc(list, 0); | ||||
| foo = push_an_edge(list, 13, 37); | ||||
| fprintf(stderr, "    push edge -> %d\n", foo); | ||||
| foo = push_an_edge(list, 24, 36); | ||||
| fprintf(stderr, "    push edge -> %d\n", foo); | ||||
| 
 | ||||
| foo = print_the_edges(list, 0); | ||||
| foo = print_the_edges(stdout, list, 0); | ||||
| 
 | ||||
| for (idx=0; idx<k; idx++) { | ||||
| 	e0 = idx*7;	e1 = 5-idx; | ||||
| 	foo = push_an_edge(list, e0, e1); | ||||
| 	if (foo) { | ||||
| 		fprintf(stderr, "push (%d, %d) -> %d\n", e0, e1, foo); | ||||
| 		fprintf(stderr, "push %d (%d, %d) -> %d\n", idx, e0, e1, foo); | ||||
| 		break; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| foo = print_the_edges(list, 0); | ||||
| foo = print_the_edges(stdout, list, 0);		puts(""); | ||||
| 
 | ||||
| foo = free_edgelist(list, 0); | ||||
| fprintf(stderr, "    free list -> %d\n", foo); | ||||
| @ -59,7 +60,7 @@ int		e0, e1; | ||||
| 
 | ||||
| fprintf(stderr, "============== %s %7d ===========\n", __func__, k); | ||||
| 
 | ||||
| list = alloc_edgelist("BIG!", k, 0); | ||||
| list = alloc_edgelist("gloubigoulba", k, 0); | ||||
| if (NULL == list) { | ||||
| 	fprintf(stderr, "%s: epic fail\n", __func__); | ||||
| 	abort(); | ||||
| @ -75,7 +76,7 @@ for (idx=0; idx<k; idx++) { | ||||
| 
 | ||||
| print_edgelist_desc(list, 0); | ||||
| 
 | ||||
| foo = print_the_edges(list, 0); | ||||
| foo = print_the_edges(stdout, list, 0);		puts(""); | ||||
| 
 | ||||
| foo = free_edgelist(list, 0); | ||||
| fprintf(stderr, "    %s: free list -> %d\n", __func__, foo); | ||||
| @ -189,6 +190,8 @@ fprintf(stderr, "*** Bubulles Testing  %s %s\n\n", __DATE__, __TIME__); | ||||
| 
 | ||||
| bubulles_version(0); | ||||
| 
 | ||||
| srand(getpid());		/*	INIT RANDOM	*/ | ||||
| 
 | ||||
| #if (0) | ||||
| test_alloc_free(5); | ||||
| test_push_pop(20000); | ||||
| @ -197,9 +200,9 @@ foo = test_peek_poke(5000); | ||||
| fprintf(stderr, "test peek/poke -> %d\n", foo); | ||||
| #endif | ||||
| 
 | ||||
| foo = essai_des_edges_A(25); | ||||
| fprintf(stderr, "test A des edges -> %d\n", foo); | ||||
| foo = essai_des_edges_B(10000); | ||||
| // XXX foo = essai_des_edges_A(25);
 | ||||
| // XXX fprintf(stderr, "test A des edges -> %d\n", foo);
 | ||||
| foo = essai_des_edges_B(5000); | ||||
| fprintf(stderr, "test B des edges -> %d\n", foo); | ||||
| 
 | ||||
| return 0; | ||||
|  | ||||
							
								
								
									
										4
									
								
								tools/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tools/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| 
 | ||||
| *.vertices | ||||
| *.edges | ||||
| 
 | ||||
| @ -1,7 +1,7 @@ | ||||
| 
 | ||||
| BBFUNCS = ../libbubulles.a  | ||||
| 
 | ||||
| OPT = -Wall -g -DDEBUG_LEVEL=1 -DMUST_ABORT | ||||
| OPT = -Wall -g -pg -DDEBUG_LEVEL=0 -DMUST_ABORT=0 | ||||
| 
 | ||||
| read_obj:	read_obj.c Makefile importobj.o $(BBFUNCS) | ||||
| 	gcc $(OPT)  $<  importobj.o $(BBFUNCS) -o $@ | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| 
 | ||||
| # Importer des fichiers .OBJ | ||||
| 
 | ||||
| 
 | ||||
| ``` | ||||
| v -1.177934647 -6.833468914 -73.19773865 | ||||
| vn -0.1279897094 -0.4501263499 -0.8837448359 | ||||
| @ -11,10 +12,10 @@ vn -0.05844723806 -0.09480132163 -0.993778944 | ||||
| Première étape : en lisant les vertices, nous saurons positionner | ||||
| nos bubulles. | ||||
| 
 | ||||
| Seconde étape : bien comprendre à quoi correspondent les | ||||
| lignes `vn` ? Des normales ? | ||||
| Attention, mon parser EXIGE des fichiers Unix bien conformés : | ||||
| c'est-à-dire que la dernière ligne du .obj DOIT être terminée | ||||
| par un newline ! | ||||
| 
 | ||||
| Et troisème étape, que faire des vertices ? | ||||
| 
 | ||||
| Quatrième étape : aller vivre à la campagne ? | ||||
| 
 | ||||
|  | ||||
| @ -16,6 +16,10 @@ extern int		verbosity; | ||||
| /* --------------------------------------------------------------------- */ | ||||
| 
 | ||||
| #define LINE_SZ			666 | ||||
| 
 | ||||
| static	BBList			*bublist; | ||||
| static	EdgeList		*edges; | ||||
| 
 | ||||
| /* --------------------------------------------------------------------- */ | ||||
| 
 | ||||
| typedef struct	{ | ||||
| @ -23,13 +27,14 @@ typedef struct	{ | ||||
| 	int		id; | ||||
| 	} Tokens; | ||||
| 
 | ||||
| enum token_id { T_comment=1, T_vertice, T_group, T_face }; | ||||
| enum token_id { T_comment=1, T_vertice, T_group, T_face, T_vt }; | ||||
| 
 | ||||
| Tokens TokenList[] = { | ||||
| 	{  "#",		T_comment	}, | ||||
| 	{  "v",		T_vertice	}, | ||||
| 	{  "g",		T_group		},	// to be verified
 | ||||
| 	{  "g",		T_group		},	// to be verified !
 | ||||
| 	{  "f",		T_face		}, | ||||
| 	{  "vt",	T_vt		},	// c'est quoi ce truc ?
 | ||||
| 	{  NULL,	0		} | ||||
| 	}; | ||||
| 
 | ||||
| @ -37,8 +42,8 @@ static int type_of_the_line(char *text) | ||||
| { | ||||
| Tokens		*token; | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, "%s is searching '%s'\n", __func__, text); | ||||
| #if DEBUG_LEVEL > 1 | ||||
| fprintf(stderr, "%s is searching for '%s'\n", __func__, text); | ||||
| #endif | ||||
| 
 | ||||
| for (token=TokenList; token->token; token++) { | ||||
| @ -51,7 +56,7 @@ for (token=TokenList; token->token; token++) { | ||||
| return -1; | ||||
| } | ||||
| /* --------------------------------------------------------------------- */ | ||||
| static int parse_vertice(char *cptr, float *px, float *py, float *pz) | ||||
| int parse_vertice(char *cptr, float *px, float *py, float *pz) | ||||
| { | ||||
| float		x, y, z; | ||||
| int		foo; | ||||
| @ -71,17 +76,66 @@ if (3 == foo) { | ||||
| return foo; | ||||
| } | ||||
| /* --------------------------------------------------------------------- */ | ||||
| int try_to_read_an_OBJ_file(char *infname, char *outfname, int notused) | ||||
| /* new Mon 27 Mar 2023 12:08:18 AM CEST */ | ||||
| int parse_face(char *cptr, int phy) | ||||
| { | ||||
| int		ix, foo; | ||||
| int		fa, fb; | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, cptr, phy); | ||||
| #endif | ||||
| 
 | ||||
| for (ix=0; ix<3; ix++) { | ||||
| 	cptr = strtok(NULL, " "); | ||||
| 	if (NULL == cptr) { | ||||
| 		fprintf(stderr, "incomplete face in %s\n", __func__); | ||||
| 		return -4; | ||||
| 		} | ||||
| 	if (2 != sscanf(cptr, "%d/%d", &fa, &fb)) { | ||||
| 		fprintf(stderr, "%s: err sscanf\n", __func__); | ||||
| 		exit(1); | ||||
| 		return -3; | ||||
| 		} | ||||
| 	// XXX fprintf(stderr, "  %d  got %d %d\n", ix, fa, fb);
 | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * yes, i've found 0-lenght edges, wtf ? | ||||
| 	 */ | ||||
| 	if (fa == fb)	{ | ||||
| 		// fprintf(stderr, "'%s' dublicate\n", cptr);
 | ||||
| 		continue; | ||||
| 		} | ||||
| 
 | ||||
| 	foo = push_a_missing_edge(edges, fa, fb); | ||||
| 	if (foo) { | ||||
| 		fprintf(stderr, "%s: disaster #%d\n", __func__, foo); | ||||
| #if MUST_ABORT		 | ||||
| 		fflush(stderr), abort(); | ||||
| #endif | ||||
| 		return -2; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, "<<< %s\n", __func__); | ||||
| #endif | ||||
| 
 | ||||
| return 0; | ||||
| } | ||||
| /* --------------------------------------------------------------------- */ | ||||
| int try_to_read_an_OBJ_file(char *infname, char *file_vert, char *file_edges, | ||||
| 				int notused) | ||||
| { | ||||
| FILE		*fpin; | ||||
| char		line[LINE_SZ+1], *cptr; | ||||
| float		x, y, z; | ||||
| int		foo, nbre, tokenid, fa, fb, ix; | ||||
| BBList          *bublist; | ||||
| int		foo, nbre, tokenid; | ||||
| Bubulle         bubulle; | ||||
| 
 | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, infname, notused); | ||||
| fprintf(stderr, ">>> %s ( '%s' %d )\n\n", __func__, infname, notused); | ||||
| #endif | ||||
| 
 | ||||
| if (NULL==(fpin=fopen(infname, "r"))) { | ||||
| @ -89,13 +143,22 @@ if (NULL==(fpin=fopen(infname, "r"))) { | ||||
| 	exit(1); | ||||
| 	} | ||||
| 
 | ||||
| bublist = alloc_bubulles(infname, 800000, 0); | ||||
| bublist = alloc_bubulles(infname, 500000, 0); | ||||
| if (NULL==bublist) { | ||||
|         fprintf(stderr, "err in %s, aborting...\n", __func__); | ||||
|         fprintf(stderr, "in %s, no mem for bubls, aborting...\n", __func__); | ||||
|         abort(); | ||||
|         } | ||||
| print_bublist_desc(bublist, 0); | ||||
| 
 | ||||
| edges = alloc_edgelist("krkrkr", 200000, 0); | ||||
| if (NULL==edges) { | ||||
|         fprintf(stderr, "no mem for edges in %s, aborting...\n", __func__); | ||||
|         abort(); | ||||
|         } | ||||
| print_edgelist_desc(edges, 0); | ||||
| 
 | ||||
| fprintf(stderr, "\n***********************************\n"); | ||||
| 
 | ||||
| nbre = 0; | ||||
| while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) { | ||||
| 
 | ||||
| @ -106,7 +169,7 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) { | ||||
| 		break; | ||||
| 		} | ||||
| 	line[strlen(line)-1] = '\0';		/* kill the newline */ | ||||
| 	if (verbosity>1) fprintf(stderr, "line read ===%s===\n", line); | ||||
| 	if (verbosity>1) fprintf(stderr, "line read ==|%s|==\n", line); | ||||
| 
 | ||||
| 	cptr = strtok(line, " "); | ||||
| 	if (NULL == cptr) { | ||||
| @ -127,49 +190,52 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) { | ||||
| 		case T_vertice: | ||||
| 			x = y = z = 0.0; | ||||
| 			foo = parse_vertice(cptr, &x, &y, &z); | ||||
| 			if (3!=foo) { | ||||
| 				abort(); | ||||
| 				} | ||||
| 			bubulle.p.x = x; | ||||
| 			bubulle.p.y = y; | ||||
| 			bubulle.p.z = z; | ||||
| 			if (verbosity > 1) niceprint_bubulle(&bubulle, 0); | ||||
| 			foo = push_bubulle(bublist, &bubulle); | ||||
| 			if (foo) { | ||||
| 				abort(); | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 		case T_group: | ||||
| 			cptr = strtok(NULL, " "); | ||||
| 			fprintf(stderr, "Group:  %s\n", cptr); | ||||
| 			fprintf(stderr, "\tGroup:  %s\n", cptr); | ||||
| 			break; | ||||
| 
 | ||||
| 		case T_face: | ||||
| 			fprintf(stderr, "Face A:  %s\n", cptr); | ||||
| 			for (ix=0; ix<3; ix++) { | ||||
| 			   cptr = strtok(NULL, " "); | ||||
| 			   fprintf(stderr, "Piste %d:  %s\n", ix, cptr); | ||||
| 			   if (2==sscanf(cptr, "%d/%d", &fa, &fb)) | ||||
| 			     fprintf(stderr, "  %d   %d %d\n", foo, fa, fb); | ||||
| 			   else | ||||
| 			      return -3; | ||||
| 			   } | ||||
| 			foo = parse_face(cptr, 0); | ||||
| 			if (foo)  fprintf(stderr, "  '%s' parse face -> %d\n", | ||||
| 							cptr, foo); | ||||
| 			break; | ||||
| 			  | ||||
| 		default: | ||||
| 			// fprintf(stderr, "token %d ?\n", tokenid);
 | ||||
| 			// fprintf(stderr, "\ttoken %d ?\n", tokenid);
 | ||||
| 			continue;		/* wtf ? */ | ||||
| 		} | ||||
| 
 | ||||
| 	foo = push_bubulle(bublist, &bubulle); | ||||
| 	if (foo) { | ||||
| 		fprintf(stderr, "*** %s: error %d on push\n", __func__, foo); | ||||
| 		exit(1); | ||||
| 		break; | ||||
| 		} | ||||
| 	nbre++; | ||||
| 	} | ||||
| fclose(fpin); | ||||
| 
 | ||||
| fprintf(stderr, "\n***********************************\n"); | ||||
| 
 | ||||
| if(verbosity) { | ||||
| 	fprintf(stderr, "%s : %d vertices loaded\n", __func__, nbre); | ||||
| 	fprintf(stderr, "in %s, %d vertices loaded\n", __func__, bublist->fidx); | ||||
| 	} | ||||
| 
 | ||||
| bubulles_to_data(outfname, NULL, bublist, 0); | ||||
| print_bublist_desc(bublist, 0); | ||||
| bubulles_to_data(file_vert, NULL, bublist, 0); | ||||
| free_bubulles(bublist, 0); | ||||
| 
 | ||||
| print_edgelist_desc(edges, 0); | ||||
| print_the_edges(stdout, edges, 0); | ||||
| free_edgelist(edges, 0); | ||||
| 
 | ||||
| return 0; | ||||
| } | ||||
|  | ||||
							
								
								
									
										7
									
								
								tools/minimal.obj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								tools/minimal.obj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| g minimal | ||||
| v 0 0 0 | ||||
| v 1 0 0 | ||||
| v 0 1 0 | ||||
| v 0 0 1 | ||||
| f 1/2, 2/3, 3/1 | ||||
| f 0/1, 0/1, 0/2 | ||||
| @ -4,23 +4,33 @@ | ||||
| 
 | ||||
| #include	<stdio.h> | ||||
| #include	<stdlib.h> | ||||
| #include	<libgen.h>		// for basename(3) | ||||
| 
 | ||||
| #include	"../bubulles.h" | ||||
| 
 | ||||
| int try_to_read_an_OBJ_file(char *fname, char *outfname, int notused); | ||||
| int	verbosity; | ||||
| int try_to_read_an_OBJ_file(char *fname, | ||||
| 				char *outfname, char *file_edges, | ||||
| 				int notused); | ||||
| 
 | ||||
| 
 | ||||
| int	verbosity = 0; | ||||
| 
 | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
| int		foo; | ||||
| char		*fname;		/* see manpage basename(3) */ | ||||
| 
 | ||||
| if (2 != argc) { | ||||
| 	bubulles_version(1); | ||||
| 	exit(0); | ||||
| 	} | ||||
| 
 | ||||
| verbosity = 1; | ||||
| verbosity = 0; | ||||
| 
 | ||||
| foo = try_to_read_an_OBJ_file(argv[1], "bubulles.asc", 0); | ||||
| fname = basename(argv[1]); | ||||
| fprintf (stderr, "input fname is '%s'\n", fname); | ||||
| 
 | ||||
| foo = try_to_read_an_OBJ_file(argv[1], "bulles.vertices", "bulles.edges", 0); | ||||
| fprintf(stderr, "try to read '%s' -> %d\n", argv [1], foo); | ||||
| 
 | ||||
| return 0; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user