2018-11-10 11:31:31 +01:00
|
|
|
/*
|
|
|
|
bubulles.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
|
2018-11-16 13:18:30 +01:00
|
|
|
#define LIBBB_VERSION 49
|
2018-11-10 11:31:31 +01:00
|
|
|
|
|
|
|
#define SZ_BUBULLE_TEXT 51 /* arbitrary value */
|
|
|
|
|
2018-11-13 13:20:35 +01:00
|
|
|
/* a 3d space coordinate */
|
2018-11-10 11:31:31 +01:00
|
|
|
typedef struct {
|
|
|
|
double x, y, z;
|
|
|
|
unsigned long reserved;
|
|
|
|
} XYZ;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
float r, g, b, a;
|
|
|
|
unsigned long reserved;
|
|
|
|
} RGBA;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
XYZ p; /* position */
|
|
|
|
double d; /* diameter */
|
|
|
|
int gray;
|
|
|
|
RGBA col;
|
|
|
|
long ttl;
|
|
|
|
double kvalue; /* wtf ? */
|
|
|
|
} Bubulle;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char name[SZ_BUBULLE_TEXT+1];
|
|
|
|
int size; /* max number of bubulles */
|
|
|
|
int fidx; /* next free slot */
|
|
|
|
XYZ position;
|
|
|
|
unsigned long flags;
|
|
|
|
Bubulle *bbs;
|
|
|
|
} BBList;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int k);
|
|
|
|
int niceprint_bubulle(Bubulle *what, int unused);
|
|
|
|
int bubulles_to_data(char *fname, char *title, BBList *bbl, int k);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
2018-11-13 13:20:35 +01:00
|
|
|
/* sometime we want to look at the bounding box */
|
2018-11-10 11:31:31 +01: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);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|