summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2026-09-27 23:39:11 +0200
committerJesper Jensen <jesper@jnsn.dev>2026-09-27 23:39:11 +0200
commitbfbecd4a3639fb4b8c85f0637c612bb65ef7ec99 (patch)
tree15d382a58012caacd84c4da9ebfb3f81dabce9c7 /examples
parentf16fc18221cd8d1a8cb1bf9e40790f3b482fb199 (diff)
downloadconstraint-borrow-component.tar.gz
constraint-borrow-component.zip
Closer to drawing the box and linesborrow-component
We're stilling missing the lines somehow
Diffstat (limited to 'examples')
-rw-r--r--examples/box_and_lines.c9
1 files changed, 7 insertions, 2 deletions
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),