From bfbecd4a3639fb4b8c85f0637c612bb65ef7ec99 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sun, 27 Sep 2026 23:39:11 +0200 Subject: Closer to drawing the box and lines We're stilling missing the lines somehow --- examples/box_and_lines.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/box_and_lines.c b/examples/box_and_lines.c index d90f208..7d63851 100644 --- a/examples/box_and_lines.c +++ b/examples/box_and_lines.c @@ -1,4 +1,5 @@ #include "cad.h" +#include "cad/debug.h" struct mid { struct component p1; @@ -135,7 +136,7 @@ void a_box(struct box *box, struct topology *topo, struct constraints *constr) { void draw_from_constraints(struct constraints *c, struct topology *t, struct canvas *cv) { struct drawing drawing = {}; - struct subassembly assemblies[16] = {}; + struct subassembly assemblies[64] = {}; size_t assemblies_num; bool rc = solve_constraints(c, &drawing, assemblies, &assemblies_num); assert(rc); @@ -148,11 +149,15 @@ void draw_from_constraints(struct constraints *c, struct topology *t, struct can } place_points(&drawing, params); + dump_program(&drawing, params); free(params); + print_subassemblies(c, assemblies, assemblies_num); + begin_drawing(cv); draw_topology(cv, t); draw_constraints(cv, c); + draw_elements(cv, &drawing); end_drawing(cv); free_drawing(&drawing); @@ -173,7 +178,7 @@ int main(int argc, char *argv[]) { add_constraint(&constraints, (struct constraint[]){ POINT_ON_LINE(&box2.bottom_left, &box1.bottom), - PP_DISTANCE(&box1.bottom_right, &box2.bottom_left, 3), + PP_DISTANCE(&box1.bottom_right, &box2.bottom_left, 5), LL_ANGLE(&box2.bottom, &box1.bottom, 0), POINT_ON_LINE(&box3.bottom_left, &box1.bottom), -- cgit v1.2.3