packing.h 688 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef packing_h
  2. #define packing_h
  3. typedef struct _node{
  4. char cutline;
  5. double width;
  6. double height;
  7. double xcord;
  8. double ycord;
  9. struct _node *left;
  10. struct _node *right;
  11. } Node;
  12. typedef struct _stack{
  13. Node *node;
  14. struct _stack *next;
  15. } Stack;
  16. Node *load_file(char *filename);
  17. void push(Stack *stackin, Node *nodein);
  18. Node *pop(Stack *stackin);
  19. void free_stack(Stack *stackin);
  20. void set_dimensions(Node *root);
  21. void set_coordinates(Node *root);
  22. void find_best_fit(Node *root, double *best_width, double *best_height);
  23. void print_nodes_inorder(Node *root);
  24. void print_nodes_postorder(Node *root);
  25. void save_boxes(char *filename, Node *root);
  26. void free_tree(Node *root);
  27. #endif