2018-11-10 21:31:31 +11:00
|
|
|
/*
|
|
|
|
bubulles.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
|
2020-06-05 09:17:17 +11:00
|
|
|
#define LIBBB_VERSION 53
|
2018-11-10 21:31:31 +11:00
|
|
|
|
|
|
|
#define SZ_BUBULLE_TEXT 51 /* arbitrary value */
|
|
|
|
|
2018-11-13 23:20:35 +11:00
|
|
|
/* a 3d space coordinate */
|
2018-11-10 21:31:31 +11:00
|
|
|
typedef struct {
|
|
|
|
double x, y, z;
|
|
|
|
unsigned long reserved;
|
|
|
|
} XYZ;
|
|
|
|
|
2018-11-24 22:46:53 +11:00
|
|
|
/* colors and transparency */
|
2018-11-10 21:31:31 +11:00
|
|
|
typedef struct {
|
|
|
|
float r, g, b, a;
|
|
|
|
unsigned long reserved;
|
|
|
|
} RGBA;
|
|
|
|
|
2018-11-25 21:44:42 +11:00
|
|
|
/*
|
|
|
|
this is our main entity : the bubulle.
|
|
|
|
'bubulle' is a slang french word for 'friendly bubble'.
|
|
|
|
*/
|
2018-11-10 21:31:31 +11:00
|
|
|
typedef struct {
|
|
|
|
XYZ p; /* position */
|
|
|
|
double d; /* diameter */
|
2018-11-24 22:46:53 +11:00
|
|
|
int gray; /* used as an index */
|
2018-11-10 21:31:31 +11:00
|
|
|
RGBA col;
|
2018-11-24 22:46:53 +11:00
|
|
|
long ttl; /* bubulles can be aged */
|
2018-11-10 21:31:31 +11:00
|
|
|
double kvalue; /* wtf ? */
|
|
|
|
} Bubulle;
|
|
|
|
|
2018-11-25 21:44:42 +11:00
|
|
|
/*
|
|
|
|
this is the bubulles list descriptor.
|
|
|
|
*/
|
2018-11-10 21:31:31 +11:00
|
|
|
typedef struct {
|
|
|
|
char name[SZ_BUBULLE_TEXT+1];
|
|
|
|
int size; /* max number of bubulles */
|
|
|
|
int fidx; /* next free slot */
|
2018-11-25 21:44:42 +11:00
|
|
|
XYZ position; /* global position */
|
2018-11-10 21:31:31 +11:00
|
|
|
unsigned long flags;
|
2018-11-25 21:44:42 +11:00
|
|
|
Bubulle *bbs; /* ptr to a movable array */
|
2018-11-10 21:31:31 +11:00
|
|
|
} BBList;
|
|
|
|
|
2018-11-25 21:44:42 +11:00
|
|
|
|
2018-11-10 21:31:31 +11:00
|
|
|
BBList * alloc_bubulles(char *name, int nbre, int k);
|
|
|
|
int free_bubulles(BBList *bbl, int k);
|
|
|
|
int print_bublist_desc(BBList *bbl, int k);
|
|
|
|
int push_bubulle(BBList *where, Bubulle *what);
|
|
|
|
int poke_bubulle(BBList *where, Bubulle *what, int idx);
|
|
|
|
int peek_bubulle(BBList *from, Bubulle *to, int idx);
|
|
|
|
|
|
|
|
int cleanfill_my_bublist(BBList *what, int k);
|
|
|
|
int bubulles_version(int k);
|
|
|
|
void bubulles_sizeof(int k);
|
|
|
|
|
|
|
|
Bubulle * bubulle_getaddr(BBList *where, int idx);
|
|
|
|
|
2020-02-01 04:38:18 +11:00
|
|
|
/*
|
2020-05-10 06:44:10 +11:00
|
|
|
* export functions for everything
|
2020-02-01 04:38:18 +11:00
|
|
|
*/
|
2020-05-10 06:44:10 +11:00
|
|
|
/* TO BE DONE XXX */
|
2020-02-01 04:38:18 +11:00
|
|
|
|
|
|
|
/*
|
|
|
|
* export Awk machinable.
|
|
|
|
* flags :
|
|
|
|
* 0x0001 print diameter
|
|
|
|
* 0x0002 print graylevel
|
|
|
|
* 0x0004 print RGB values
|
|
|
|
*/
|
|
|
|
int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int flags);
|
|
|
|
|
|
|
|
/* only human readable */
|
2018-11-10 21:31:31 +11:00
|
|
|
int niceprint_bubulle(Bubulle *what, int unused);
|
2020-02-01 04:38:18 +11:00
|
|
|
|
|
|
|
/* this is just a wtf function * see tbb.c */
|
2018-11-10 21:31:31 +11:00
|
|
|
int bubulles_to_data(char *fname, char *title, BBList *bbl, int k);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
2018-11-13 23:20:35 +11:00
|
|
|
/* sometime we want to look at the bounding box */
|
2018-11-10 21:31:31 +11:00
|
|
|
typedef struct {
|
|
|
|
double minX, minY, minZ;
|
|
|
|
double maxX, maxY, maxZ;
|
|
|
|
int flags;
|
|
|
|
} BBox;
|
|
|
|
|
|
|
|
int bounding_box(Bubulle *boubs, int nbre, BBox *bbox);
|
|
|
|
int print_bbox(BBox *bbox, int k);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|