From fd0be422180178516d6d2bf3fb1f343c9ab79e53 Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Fri, 24 Dec 2021 23:51:11 +0100 Subject: WIP c implementation --- src_c/common.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src_c/common.h') diff --git a/src_c/common.h b/src_c/common.h index 660932f..c83f808 100644 --- a/src_c/common.h +++ b/src_c/common.h @@ -13,15 +13,9 @@ ((opcut_params_t){.cut_width = 0, \ .min_initial_usage = false, \ .panels = NULL, \ - .panels_len = 0, \ - .items = NULL, \ - .items_len = 0}) + .items = NULL}) #define OPCUT_RESULT_EMPTY \ - ((opcut_result_t){.params = NULL, \ - .used = NULL, \ - .used_len = 0, \ - .unused = NULL, \ - .unused_len = 0}) + ((opcut_result_t){.params = NULL, .used = NULL, .unused = NULL}) #ifdef __cplusplus extern "C" { @@ -32,22 +26,24 @@ typedef struct { size_t len; } opcut_str_t; -typedef struct { +typedef struct opcut_panel_t { opcut_str_t id; double width; double height; // internal + struct opcut_panel_t *next; double area; } opcut_panel_t; -typedef struct { +typedef struct opcut_item_t { opcut_str_t id; double width; double height; bool can_rotate; // internal + struct opcut_item_t *next; double area; } opcut_item_t; @@ -55,20 +51,21 @@ typedef struct { double cut_width; bool min_initial_usage; opcut_panel_t *panels; - size_t panels_len; opcut_item_t *items; - size_t items_len; } opcut_params_t; -typedef struct { +typedef struct opcut_used_t { opcut_panel_t *panel; opcut_item_t *item; double x; double y; bool rotate; + + // internal + struct opcut_used_t *next; } opcut_used_t; -typedef struct { +typedef struct opcut_unused_t { opcut_panel_t *panel; double width; double height; @@ -76,6 +73,7 @@ typedef struct { double y; // internal + struct opcut_unused_t *next; double area; bool initial; } opcut_unused_t; @@ -83,9 +81,7 @@ typedef struct { typedef struct { opcut_params_t *params; opcut_used_t *used; - size_t used_len; opcut_unused_t *unused; - size_t unused_len; // internal double panels_area; -- cgit v1.2.3-70-g09d2