summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-11-23 22:12:27 +0100
committerJesper Jensen <jesper@jnsn.dev>2025-11-23 22:12:27 +0100
commitf8463d52a7c6cb6de6fde0f2472c44cf35e2452a (patch)
tree13850d2d04d72d67b04cc1375f8a2111432e41c2 /src/main.c
parent84f11b37d178242d4ff80c4f3b4eddb54efe59ea (diff)
Move angle offsets to the construction VM
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/main.c b/src/main.c
index 7f3ec26..964c5c0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -321,26 +321,11 @@ int main(int argc, char *argv[]) {
struct drawing drawing = {};
solve_constraints(&constraints, &drawing);
+ // Copy over all the parameter values to a new array
+ // @PERF: Maybe we should just store them in a separate array to start with
double *params = malloc(sizeof(double) * (constraints.length));
for(size_t i = 0; i < constraints.length; i++) {
- if(!constraints.elements[i].used) continue;
- if(constraints.elements[i].order == 0) continue;
-
- params[i] = SETSIGN(constraints.elements[i].forward, constraints.elements[i].v);
-
- // We need to offset angles based on the path we took to use this
- // constraint
- if(constraints.elements[i].path[0].i != -1) {
- // printf("PATH %ld order %llu\n", i, constraints[i].order-1);
- for(struct path_step *p = constraints.elements[i].path; p <= constraints.elements[i].path+SEARCH_DEPTH && p->i != -1; p++) {
- params[i] += SETSIGN(p->direction, constraints.elements[p->i].v);
- // printf("%llu [%d:%f] [%f] -> ", p->i, p->direction, constraints[p->i].v, params[constraints[i].order-1]);
- }
- // printf("\n");
- params[i] -= (M_PI*2.0) * floor(params[i] / (M_PI*2.0));
- // printf("Final Angle is %f\n", params[constraints[i].order-1]);
- }
-
+ params[i] = constraints.elements[i].v;
}
execute_drawing(&drawing, params);