diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-11-02 20:56:45 +0100 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-11-02 20:56:45 +0100 |
| commit | c74fc3a706389834bd4ed210594b82e6e787ee40 (patch) | |
| tree | e8d942f673357b007b25042148eec944464696c6 /inc | |
| parent | 38ed4b2f738ef6b74ce6b7c7d1788b3d0ec555d9 (diff) | |
Split the solver into it's own file
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/cad/solve.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/inc/cad/solve.h b/inc/cad/solve.h new file mode 100644 index 0000000..cb2c4ac --- /dev/null +++ b/inc/cad/solve.h @@ -0,0 +1,50 @@ +#pragma once + +#include "cad/construction.h" + +#define SEARCH_DEPTH 16 + +enum component_type { + COM_POINT, + COM_LINE, +}; + +struct component { + enum component_type type; + + struct element *e; + + bool show_when_placed; + + double min; + double max; + bool min_max_init; + bool drawn; +}; + +extern char *constraint_type_name[]; +enum constraint_type { + CT_POINT_POINT_DISTANCE, + CT_POINT_LINE_DISTANCE, + CT_LINE_LINE_ANGLE, +}; + +struct path_step { + uint64_t i; + bool direction; +}; + +struct constraint { + enum constraint_type type; + double v; + + struct component *c1; + struct component *c2; + + uint64_t order; + struct path_step path[SEARCH_DEPTH]; + bool forward; + bool used; +}; + +bool solve_constraints(struct constraint *constraints, size_t constraints_num, struct drawing *drawing); |
