diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-11-30 11:22:18 +0100 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-11-30 11:22:18 +0100 |
| commit | e22588e908a9a2b172a8965cfd8767305dcb3459 (patch) | |
| tree | 369bd419c4df089f535535a3781a99315a999d35 /inc/cad/solve.h | |
| parent | f8463d52a7c6cb6de6fde0f2472c44cf35e2452a (diff) | |
Move around some macro defs
Diffstat (limited to 'inc/cad/solve.h')
| -rw-r--r-- | inc/cad/solve.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/inc/cad/solve.h b/inc/cad/solve.h index 85b902b..bdfdf94 100644 --- a/inc/cad/solve.h +++ b/inc/cad/solve.h @@ -45,6 +45,38 @@ enum constraint_type { CT_END, }; +#define PP_DISTANCE(C1, C2, D) \ + { \ + .type = CT_POINT_POINT_DISTANCE, \ + .v = D, \ + .c1 = C1, \ + .c2 = C2, \ + } + +#define PL_DISTANCE(C1, C2, D) \ + { \ + .type = CT_POINT_LINE_DISTANCE, \ + .v = D, \ + .c1 = C1, \ + .c2 = C2, \ + } + +#define POINT_ON_LINE(C1, C2) \ + PL_DISTANCE(C1, C2, 0) + +#define LL_ANGLE(C1, C2, D) \ + { \ + .type = CT_LINE_LINE_ANGLE, \ + .v = D, \ + .c1 = C1, \ + .c2 = C2, \ + } + +#define CEND() \ + { \ + .type = CT_END, \ + } + struct path_step { uint64_t i; bool direction; @@ -66,3 +98,5 @@ struct constraint { void alias_point(struct constraints *c, struct component *alias, struct component *target); void add_constraint(struct constraints *c, struct constraint *new); bool solve_constraints(struct constraints *constraints, struct drawing *drawing); + +#define DEG(x) ((x) * M_PI / 180.0) |
